Search code examples
c#unit-testingdebuggingmstest

How to increase global timeout of unit test run whith mstest


We have a large battery of unit tests and due to Visual Studio 2008 performance problems we usually run the tests from command line with MsTest.

When we want to debug a test, we attach Visual Studio to VSTestHost process or call the debugger from code with Debugger.Break(). The problem is that when debugging the unit test this way, tests exit due to a timeout after five minutes. It is ok for us to have this timeout when running the unit tests, but we find it annoying when debugging, because we cannot continue after five minutes.

We don´t want to use the Timeout attribute because we only need to increase the timeout when debugging the unit tests.

We have tried using a different testrunconfig file setting:

<Timeouts runTimeout="2147483647" testTimeout="2147483647" />

but with no effect.

We have enabled logging for vstesthost.exe and we find in the trace file the following lines:

vstesthost.exe: AgentObject: Cleanup called with timeout of 30000

Anyone could give us a clue about how to pass a parameter to vstesthost.exe telling the timeout we want for the test run?


Solution

  • After searching the message of the timeout found in the trace file, we have found this question (Cannot debug inside of ClassCleanup (timeout?)) where a MSFT employee answers that the timeout of the test agent in Visual Studio 2008 is not configurable. So it seems that the only way is to update our IDE.