Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are tests taking longer to run in TeamCity than when run directly in NUnit?

I have some C# performance tests, basically running two different methods and checking that one runs much faster than the other.

When I run them locally in NUnit, one of the tests runs ten times as fast as the other, so I've got an NUnit test that uses Stopwatch to check that it is at least twice as fast (in case of regression). But when I run the tests in TeamCity, the fast method is only about 1.5 times as fast as the slow one? I would expect hardware differences to have some effect, but not this much. What could be causing this?

like image 889
Matthew Strawbridge Avatar asked Jan 16 '12 17:01

Matthew Strawbridge


1 Answers

To answer my own question, the problem turned out to be that code coverage was turned on for the test build in TeamCity, so the overhead of this brought the two method runtimes closer together. Hopefully this answer helps someone else in future.

like image 101
Matthew Strawbridge Avatar answered Sep 28 '22 08:09

Matthew Strawbridge