简体   繁体   English

DotNet Core 一次运行测试

[英]DotNet Core run test once at time

I'm looking for a way for my xUnits to run tests one at a time (dotnet test (version core 6)).我正在寻找一种方法让我的 xUnit 一次运行一个测试(dotnet 测试(版本核心 6))。 Both from code and configuration.来自代码和配置。

In particular, the tests will have to be launched via an action on github特别是,必须通过对 github 的操作启动测试

Thanks谢谢

You could use xunit.runner.json file:您可以使用xunit.runner.json文件:

{
  "parallelizeAssembly": false,
  "parallelizeTestCollections": false
}

And then in your csproj然后在你的csproj

<ItemGroup>
  <None Update="xunit.runner.json"> 
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
</ItemGroup>

You can also write in code也可以写代码

[assembly: CollectionBehavior(DisableTestParallelization = true)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM