Visual Studio 2012可以并行运行单元测试吗?

时间:2022-03-29 13:49:57

Can Visual Studio 2012 run unit tests in parallel? Visual Studio 2010 has an option to do this:

Visual Studio 2012可以并行运行单元测试吗? Visual Studio 2010有一个选项可以执行此操作:

http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

...but I can't find anything similar in Visual Studio 2012. I tried the procedure described in the referenced article, but even loading the same test settings file I was unable to run tests in parallel.

...但我在Visual Studio 2012中找不到类似的东西。我尝试了参考文章中描述的过程,但即使加载相同的测试设置文件,我也无法并行运行测试。

4 个解决方案

#1


14  

No. VS2012 unit test framework currently does not run tests in parallel.

VS2012单元测试框架目前没有并行运行测试。

Edit: Moving a part of the comments with Dave into the answer for better reference.

编辑:将部分评论与Dave一起移动到答案中以便更好地参考。

See this link on how to enable parallel runs using the .testsettings. Once you have this configured in your .testsettings file you can then set that as the active settings file in VS and this which will force the execution in the legacy mstest framework, where this feature is available.

请参阅此链接,了解如何使用.testsettings启用并行运行。在.testsettings文件中配置完成后,可以将其设置为VS中的活动设置文件,这将强制执行此功能可用的旧版mstest框架中的执行。

#2


4  

You can force VS2012 to use the 2010 test settings file. You can add FileName.testsettings into the 2012 .runsettings file. This is considered legacy and probably won't be supported forever.

您可以强制VS2012使用2010测试设置文件。您可以将FileName.testsettings添加到2012 .runsettings文件中。这被认为是遗留的,可能永远不会得到支持。

e.g.

<MSTest>
 <CaptureTraceOutput>True</CaptureTraceOutput>
 <DeploymentEnabled>False</DeploymentEnabled>
 <SettingsFile>FILENAME.testsettings</SettingsFile>
 <ForcedLegacyMode>True</ForcedLegacyMode>
</MSTest>

#3


2  

I have a test project upgraded from 2010 to 2012. It won't run in parallel in the IDE, but using mstest.exe with the test DLL works fine.

我有一个测试项目从2010年升级到2012年。它不会在IDE中并行运行,但使用mstest.exe与测试DLL工作正常。

#4


1  

Visual Studio 2012 doesn't allow to run tests in parallel.

Visual Studio 2012不允许并行运行测试。

But you can try ParallelTestRunner tool to run Visual Studio 2012/2013/2015 tests in parallel from the command line.

但您可以尝试使用ParallelTestRunner工具从命令行并行运行Visual Studio 2012/2013/2015测试。

#1


14  

No. VS2012 unit test framework currently does not run tests in parallel.

VS2012单元测试框架目前没有并行运行测试。

Edit: Moving a part of the comments with Dave into the answer for better reference.

编辑:将部分评论与Dave一起移动到答案中以便更好地参考。

See this link on how to enable parallel runs using the .testsettings. Once you have this configured in your .testsettings file you can then set that as the active settings file in VS and this which will force the execution in the legacy mstest framework, where this feature is available.

请参阅此链接,了解如何使用.testsettings启用并行运行。在.testsettings文件中配置完成后,可以将其设置为VS中的活动设置文件,这将强制执行此功能可用的旧版mstest框架中的执行。

#2


4  

You can force VS2012 to use the 2010 test settings file. You can add FileName.testsettings into the 2012 .runsettings file. This is considered legacy and probably won't be supported forever.

您可以强制VS2012使用2010测试设置文件。您可以将FileName.testsettings添加到2012 .runsettings文件中。这被认为是遗留的,可能永远不会得到支持。

e.g.

<MSTest>
 <CaptureTraceOutput>True</CaptureTraceOutput>
 <DeploymentEnabled>False</DeploymentEnabled>
 <SettingsFile>FILENAME.testsettings</SettingsFile>
 <ForcedLegacyMode>True</ForcedLegacyMode>
</MSTest>

#3


2  

I have a test project upgraded from 2010 to 2012. It won't run in parallel in the IDE, but using mstest.exe with the test DLL works fine.

我有一个测试项目从2010年升级到2012年。它不会在IDE中并行运行,但使用mstest.exe与测试DLL工作正常。

#4


1  

Visual Studio 2012 doesn't allow to run tests in parallel.

Visual Studio 2012不允许并行运行测试。

But you can try ParallelTestRunner tool to run Visual Studio 2012/2013/2015 tests in parallel from the command line.

但您可以尝试使用ParallelTestRunner工具从命令行并行运行Visual Studio 2012/2013/2015测试。