2

Is there any way to run the C# test in single thread? I am not looking for a thread safe but for a single thread. Actually my COM component can be used in single thread only so when i run my first test it runs fine but as soon as it enters another it fails as COM component cannot be assigned to another thread"

2 Answers2

1

MSTest doesn't support single-threaded testing. You'll therefore have to use another testing framework. Many options exist, though NUnit and XUnit would both meet your needs and both are popular.

Community
  • 1
  • 1
David Arno
  • 41,717
  • 15
  • 81
  • 129
0

VSTest.Console.Exe suppose to replace MSTest. It uses single thread -see How does the Visual Studio 2012 test runner apply threading?.

If you solution using .runsettings(e.g. see Configure unit tests by using a .runsettings file ) Visual Studio will run VSTest.Console.Exe.

More details about MSTest/VStest differences are in Choose and configure a test runner

Community
  • 1
  • 1
Michael Freidgeim
  • 23,917
  • 16
  • 136
  • 163