.net - "dotnet test": how to run xunit tests projects in parallel?

标签 .net testing .net-core xunit xunit2

我正在使用单个命令从解决方案级别运行所有测试项目: dotnet test 如何让所有测试项目(程序集)并行运行?

在 Visual Studio 中有一个简单的按钮“并行运行测试”,它工作得很好,但我需要为 CI 使用 dotnet core test 命令。

最佳答案

目前不支持将标志传递给 dotnet test 的方法。您必须使用 configuration files相反。

xunit.runner.json:

{
    "parallelizeAssembly": true
}

parallelizeAssembly 默认为 false

Set this to true if this assembly is willing to participate in parallelization with other assemblies. Test runners can use this information to automatically enable parallelization across assemblies if all the assemblies agree to it.

parallelizeTestCollections 默认为 true

Set this to true if the assembly is willing to run tests inside this assembly in parallel against each other. Tests in the same test collection will be run sequentially against each other, but tests in different test collections will be run in parallel against each other. Set this to false to disable all parallelization within this test assembly.

关于.net - "dotnet test": how to run xunit tests projects in parallel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53955469/

相关文章:

c# - 强制 MySQL Connector.NET 返回一个 bool 值

.net - 使用 NLog 登录到独立存储

linux -/usr/bin/bash : No such file or directory

c# - .net core2 Data isn't null 但 View Keep saying Data is Null

c# - ModelState 在 ASP.NET.CORE 2.2 Web Api 中始终有效

.net - 如何只允许在文本框中输入英文 (A-Z) 字符?

c# - 在 ASP.NET MVC 中以编程方式验证模型列表

testing - 负载测试数据库实例

javascript - 自定义匹配器使 Jasmine 挂起

.net-core - 没有 ASP.Net 的 grpc-dotnet 服务器