TFS 2013 构建:运行 在多个构建代理上并行进行单元测试

TFS 2013 Build: Running Unit Tests in Parallel on multiple build agents

我有一个 XAML 构建定义 运行 用于我的 MSTest 单元测试,执行所有这些测试需要很长时间。我在构建环境中设置了 4 个构建代理(每个虚拟机有 1 个核心)。我在 XAML 中使用 Microsoft.TeamFoundation.Build.Activities.RunAgileTestRunner activity "Run on Agent"(Microsoft.TeamFoundation.Build.Workflow.Activities.AgentScope) activity.

目前,单元测试在其中一个代理上执行。我希望能够将单元测试分发给其他可用的代理。有没有办法通过 TFS 配置或更改构建定义来做到这一点。

作为一种变通方法,我可以将单元测试项目拆分为多个项目,然后 运行 它们在可用代理上分开,但是我无法在一个地方看到构建摘要。

最好的解决方案是什么?

只需查看这篇文章:How to run automated tests on different machines in parallel?

The Recommended option:

  • Create multiple environments with each environment consisting of single machine (read single agent).

  • Divide all your test cases onto different sets and queue one set on one environment and other set on other environment and so on.

  • With this each set of test will run in parallel and on different machine.

另请参考以下文章:


此外,如果升级到 VNext 构建是一个选项,那么您可以按照以下文章中提到的步骤轻松实现: