chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
+1 vote
I have an NUnit TestFixture with 14 tests; most (13) run fine with DotCover without failing every single time. There is one test, however that always fails when ran in the above-mentioned \\\"bulk-running\\\" procedure; but if I run it by itself it passes.

Now, if I ignore the above failing method and all the rest (13) all pass just fine.

My setup: I have setup() and teardown() methods (included to rule-out anything weird) that looks like the following; yes, I am not using the Isolated attribute in the TestFixture class:


There is nothing exciting about these unit tests except faking the next instance :

 var fakeUdpTarget = Isolate.Fake.NextInstance<UdpTarget>();

Wondering if you have seen this in the past from perhaps other customers and if you can provide a work-around to getting this intermittent test to pass every single time.

I don\\\'t think I can \\\"debug\\\" this failing test but I\\\'ll give it a shot by running both and setting a breakpoint on the latter.

The theory is that setup for the first is not getting properly cleaned up when the 2nd one runs..... The failure message is on the assert which means the \\\"setup\\\" was wrong; but again, the unit test runs fine in Isolation.

I\\\'ve also read this post:


Solved my own problem:

The class under test had a static constructor which needs to be called per each test with TypeMock-> Isolate.Invoke.StaticConstructor<myclass>();
asked by afuste (1.6k points)

Please log in or register to answer this question.