nunitnunit-2.5

NUnit slowing down test execution when loading multiple tests with test case sources


I am running an NUnit (version 2.5.10) test from GUI runner. I observed that when the test is run with just that single test loaded, it takes a lot less time than when it is run with the entire test suite loaded.

I experimented by commenting all the test case sources used in other tests, that did bring down the time but it is still higher than loading a single test.

My question is why does commenting the other test case sources brings down the time it takes to run the test. I can understand that it will reduce the tests load time, but why would it impact test run time.

Also, is there any other thing that can affect the test performance.


Solution

  • I think I found the problem. One of the unit test was explicitly calling GC.Collect(). This was taking a long time when entire test suite is loaded since there are more objects in memory.