如何并行运行单元测试(MSTest的)? [英] How to run unit tests (MSTest) in parallel?
问题描述
我在寻找各种方法来并行运行测试套件。
我知道 .testrunconfig
设置。这可以让你的复在CPU的数量。
我要运行并行测试1000。这是有意义的,因为我正在测试的web服务,因此90%的在测试所花的时间是等待服务响应。
这是怎么拉这一关任何想法?该测试主要是针对VS写的,但我愿意VS.之外运行它们
后来修改:Visual Studio的测试团队已在2015年VS更新1.见马克Sowul的回答波纹管添加了此。
的Visual Studio 2015年更新1添加此。
<一href=\"https://www.visualstudio.com/news/vs2015-update1-vs#misc\">https://www.visualstudio.com/news/vs2015-update1-vs#misc
有关更新2,在工具栏中有一个UI复选框(在'组'和'搜索'框之间)。
有关更新1,设置在.runsettings以下
&LT;?XML版本=1.0编码=UTF-8&GT?;
&LT; RunSettings&GT;
&LT; RunConfiguration&GT;
&所述; MaxCpuCount大于0&下; / MaxCpuCount&GT;
&LT; / RunConfiguration&GT;
&LT; / RunSettings&GT;
有关MaxCpuCount值具有以下语义:
•'N'(其中1&LT; = N&LT; =核心数量):高达'N'进程将推出
•其它任何值的N:推出进程数将多达计算机上的可用内核
块引用>I am looking for ways to run test suites in parallel.
I am aware of
.testrunconfig
setting. This allows you to multiplex on the number of CPUs.I want to run 1000 tests in parallel. This makes sense because I am testing a web service, so 90% of the time spent in a test is waiting for the service to respond.
Any ideas on how to pull this off ? The tests are written for VS, but I am open to running them outside of VS.
Later edit: the Visual Studio test team have added this in VS 2015 Update 1. See Mark Sowul's answer bellow.
解决方案Visual Studio 2015 Update 1 adds this. https://www.visualstudio.com/news/vs2015-update1-vs#misc
For Update 2, there is a UI checkbox in the toolbar (between the 'grouping' and 'search' boxes).
For Update 1, Set the following in the .runsettings
<?xml version="1.0" encoding="utf-8"?> <RunSettings> <RunConfiguration> <MaxCpuCount>0</MaxCpuCount> </RunConfiguration> </RunSettings>
The value for MaxCpuCount has the following semantics:
• ‘n’ (where 1 <= n <= number of cores) : upto ‘n’ processes will be launched.
• ‘n’ of any other value : The number of processes launched will be as many as the available cores on the machine.
这篇关于如何并行运行单元测试(MSTest的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!