Monday 25 July 2011

How to get your unit tests (test project in Visual Studio 2008, a.k.a. MSTest) run multithreaded

 

Add this to the configuration for the test

<TestRunConfiguration ...>

...

<ExecutionThread apartmentState="MTA" />

</TestRunConfiguration>

To check the threading model used, add the following line to your test(s):

[TestMethod]

public void YourTest()

{

System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.GetApartmentState().ToString());

// TODO: Add test logic here

}

http://blogs.msdn.com/b/irenak/archive/2008/02/22/sysk-365-how-to-get-your-unit-tests-test-project-in-visual-studio-2008-a-k-a-mstest-run-multithreaded.aspx

No comments:

Post a Comment

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...