2

我希望有人能帮助我。

我在 VS2010 中对我的 C# 应用程序有很多 UnitTest,因此我想并行执行它们,这样我就可以从我的四核机器中受益。这可以通过在 Local.testsettings 中添加parallelTestCount="0"来“轻松”完成。

但是我的一些 UnitTest(大约 50 个)不是线程安全的,而不是重新设计它们,我只是希望它们以非并行模式运行。

这可能吗?如果可以,该怎么做?

4

1 回答 1

0

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.

于 2012-04-13T12:41:27.780 回答