问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/8884168/why-are-tests-taking-longer-to-run-in-teamcity-than-when-run-directly-in-nunit