XUnit dotnet test parallel threads amount

Viewed 91

How can I specify amount of threads while using dotnet test

Xunit 2.4.1 Xunit.runner.visualstudio 2.4.5 netcoreapp 3.1

The issue: I have a Job that is running tests using dotnet test and I have different agent with different performance capacity. For example One machine can handle 10 threads and the other only 6. Now the amount of threads specified in xunit.runner.json file. Could I specify amount of threads from the console? or can I specify the config file to use?

1 Answers

According to the xUnit docs, you should reference xunit.runner.json within your csproj file like this:

<ItemGroup>
  <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

Doing so should pick up the config file in all cases (CLI, UI, etc.).

Related