c# - OrderedTest- Not keeping values from previous Test. - visualstudio208 - Unit Testing -


I'm testing the application using the VSTS 2008 unit test to test the unit. My problem is this: I want to call two test cases in one order. I am using the Test case facility ordered for VSTS 2008. The problem I am facing, I increase the value of a variable (X) in Test A and I am doing some cheating in Test B on the basis of that value. But when the test comes in Test B, I get an initial value of X, but it is not that which was increased in Test A. I think that for every exam, vsts make a new example of test class in memory. Please suggest a solution other than using STATIC variables.

The code for the same is given below

  [TestMethod ()] Public Zero FF () {i = 11; } [TestMethod ()] Public Zero GG () {if (i == 4) {System.Diagnostics.Debug.WriteLine ("This is 4"); } Else {System.Diagnostics.Debug.WriteLine ("This is 7"); }}  

Thanks in advance

Is it possible to redesign Is your tests run in a way differently? This is the right way to test in 99% of cases. Although it increases a little overhead, and you can repeat your setup a little bit, it is easier to maintain, and each test can focus on this same function, worry about environmental change Without doing


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -