When running all unit tests with NUnit, some hang. Running individually they pass.


I am running C# unit tests in Visual Studio 2015 using Resharper 10.0.2 and NUnit 3.7.1.  I have several test classes.  When I run each test class individually, they all pass.  When I run the entire suite of tests, one particular class hangs.  The test class that hangs contains several tests.  If I comment out all tests except one particular test, then the entire suite will pass.  If I uncomment any individual unit test previously commented out, then the class hangs. I have debugged each individual unit test and none of them hang or cause any exception. 

Two other colleagues have the same experience running my unit tests in their environments.  I am not trying to run in parallel (number of assemblies to run in parallel = 1).

Any suggestions to diagnose the problem?

1 comment
Comment actions Permalink

I solved this issue after discovering that my application code was changing the mouse cursor using the following:

Application.Current.Dispatcher.Invoke(() =>


Mouse.OverrideCursor = Cursors.Wait;



After removing the Application.Current.Dispatcher.Invoke(), the issue was resolved.  No more hangs.



Please sign in to leave a comment.