No, this is not possible in Visual Studio 2008 using the default tools.
This is possible by adding some ... interesting configuration code to the TestInit method. For example, you can use all of your test classes from the following base class.
[TestClass] public class ExecuteOneAtTimeBase { private static object s_mutex = new object(); [TestInit] public void TestInit() { Monitor.Enter(s_mutex); } [TestCleanup] public void TestCleanup() { Monitor.Exit(s_mutex); } }
All TestMethod instances are enclosed in square brackets on calls to the TestInit and TestCleanup methods. Using the Monitor.Enter / Exit combination, you can ensure that this unit test method holds the lock for the duration of its execution. Therefore, multiple threads cannot run different tests at the same time in the same AppDomain application.
There are cases of errors when this can lead to a deadlock in the testing process. But I think this is probably a minor issue as it is not production code.
source share