Tests on Visual Studio test slower on TFS Build

In my project, there are more than 1000 unit tests that run on the local computer in less than 10 seconds. But when they run on TFS Build, some tests run much slower than others. 3 of them work after about 1-2 minutes, the other 4 after 5-30 seconds, and the rest in a split second. I noticed that all those slow tests use fakes from Microsoft Fakes, and each of them is the first to run a class in it. But many other tests also use fakes (even more intensively) and run in normal time. I would like to know what can slow down and how I can fix it.

Edit: I noticed that every slow test passes after the test without makeup. Perhaps this slowdown is caused by the initialization of the ShimsContext. In my test classes, a ShimsContext is created and hosted in the TestInitialize and TestCleanup methods. Does this affect performance significantly?

+7
c # tfs unit-testing visual-studio-2013 microsoft-fakes
source share

No one has answered this question yet.

See related questions:

1270
Why not inherit from List <T>?
830
Unit Testing C Code
717
JavaScript unit test tools for TDD
681
What is Unit test, integration test, Smoke test, regression test?
646
How do I use unit test threaded code?
573
Is unit testing worth the effort?
566
How to disable all header headers in Visual Studio
46
Running a specific unit test in Visual Studio
3
How to run unit test with multiple data sources?
2
Unit tests get slow when using Microsoft fakes in OTHER tests

All Articles