Is there any solution to the slowness of the first NUnit test when using Entity Framework 4.1?
I find that the first test takes about 10 seconds, the rest of my tests run after 0.01 seconds (according to the Resharper Show Time parameter)
If I run tests using the NUnit GUI, again the first test takes 10 seconds, but if I re-run the entire test suite, skipping in less than 0.5 seconds ... until I recompile the solution
I also have NUnit tests of a WCF service hosted in IIS that calls EF, and the first ends after about 3 seconds. Then, if I re-run the tests, it will drop to 1 second and, as expected, recompiling for the first time will return for 3 seconds.
But the original NUnit tests, which refer to the class library with methods that call EF, are always around 10 seconds, i.e. without reducing the time
Ok, I realized that IIS does โsomethingโ [what?], But in both cases I use NUnit to make calls ... why for the first call is 10 + seconds, the other is 3 seconds and then 1 second on subsequent challenges
And to really confuse me, I wrote a simple console application that calls one of the EF using methods in the tested class, and it manages to complete in 1 second.
UPDATE ... the same tests that were overwritten since the MSTest tests finish the first test in about 3.5 seconds, which is comparable to the first test run in the NUnit GUI runner, so the problem seems to be Resharper test runner for NUnit in Visual Studio
UPDATE 2 ... yes, the problem seems to be the Resharper test runner. TestDriven.NET and Visual Nunit 2010 are faster.
UPDATE 3 ... and now it is registered by JetBrains as a problem