I have defined a global variable say public int a=0;
There are two testmethods: login() and Search()
and following payback setting is set in TestInitialize
Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;
Now, in the test method login() I have written a line : a++ which sets the value of a as 1,
Now, when the Search() method is executed the value of a = 0 rather than 1.
So, can you please help how to maintain the session of the variables between Test Methods.
There are two testmethods: login() and Search()
and following payback setting is set in TestInitialize
Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;
Now, in the test method login() I have written a line : a++ which sets the value of a as 1,
Now, when the Search() method is executed the value of a = 0 rather than 1.
So, can you please help how to maintain the session of the variables between Test Methods.
If you want to share a variable between tests use a static variable, public static int a.
ReplyDelete