简体   繁体   中英

Different UnitTest executions in one MSTest settings file

I hope somebody can help me.

I have a lot of UnitTest to my C# application in VS2010, and therefore I want to execute them in parallel so I can benefit of my four core machine. This is "easily" done by adding parallelTestCount="0" to the execution in the Local.testsettings.

But some of my UnitTest (around 50) are not thread safe and instead of reworking them, I just want them to be run in not parallel mode.

Is that possible and if so how to do it?

You can't change the parallelism on a single test or set of tests. You could try to create a second test settings file and a second assembly containing your "unsafe" tests; you can define the folder that test assemblies are loaded from under the "Unit test" tab of the test settings dialog.

That said, your tests should be thread-safe. A unit test should be able to run in any order, in any environment, and always pass -- unless, of course, something changed in the code they're testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM