4

We upgraded our unit test project from .NET 3.5 to .NET 4.0. We also upgraded NUnit from 2.5.2 to 2.59. Now the unit tests time out after 50 minutes when they used to finish in about 15 minutes. These tests are run on JetBrains TeamCity 6.0.2 on our dev server. Does anyone know what could cause this? Some individual tests take up to 8 minutes now.

Thanks,

Jason

Fahad
  • 1,261
  • 9
  • 19
user661082
  • 41
  • 1
  • 2
    my first step would be to run the tests in a debugger, and randomnly hit pause every once in a while to get a rough idea of where execution is stalling. – Winston Ewert Mar 15 '11 at 20:14
  • 1
    You could try running a statistical profiler over the NUnit test runner while running the tests. Run it for 20 mins or so then kill the test runner. I use NProf (http://code.google.com/p/nprof/) which unfortunately isn't maintained any more, don't know if it will work with .NET 4 though. – Rebecca Scott Mar 15 '11 at 22:28
  • Do the tests run properly (in .net 4.0) on your local dev box? I would suspect .net 4 not installed on your test server, or something along those lines. Maybe an exception thats not getting reported? – TheSean Mar 17 '11 at 17:13
  • Do you think it is the test framework that has gotten slower, or the tested code? If it is the latter, try to isolate it down to a single test. – Doc Brown Mar 18 '11 at 08:33
  • We’ve had problems with tests timing out after a similar upgrade because of threads started in our unit tests (and not terminating properly). But we did not experience _slowness_, only _completely stuck_ tests. – Mormegil Mar 18 '11 at 08:55
  • Well, I figured it out. There were places on our domain object classes where we had validators (MS Enterprise Library) on public properties. The validators were referencing keys from the project's resource file. We had nonexistent resource keys in our validators. This was causing the errors which caused our unit tests to time out. I guess .NET 4.0 is being more strict. Thanks for everyone's suggestions. - Jason – user661082 Mar 18 '11 at 21:51

1 Answers1

0

Well, I figured it out. There were places on our domain object classes where we had validators (MS Enterprise Library) on public properties. The validators were referencing keys from the project's resource file. We had nonexistent resource keys in our validators. This was causing the errors which caused our unit tests to time out. I guess .NET 4.0 is being more strict. Thanks for everyone's suggestions. - Jason –

user661082
  • 41
  • 1
  • The best way to debug TeamCity unit test timeouts is to remote into the build server and run the same unit tests. Most likely there are errors that TeamCity is unable to detect, such as in your case. – Keith May 13 '11 at 18:58