Hi Dipesh,
The example you are referring to applies to more recent versions of MATLAB. R2014b was the first release in MATLAB that supported script-based unit tests, but the "shared variable section" was not supported until R2015a .
Here is the link to the R2014b documentation for writing script based unit tests.
Hope that helps! Andy