Home > database >  DotNet Core run test once at time
DotNet Core run test once at time

Time:08-24

I'm looking for a way for my xUnits to run tests one at a time (dotnet test (version core 6)). Both from code and configuration.

In particular, the tests will have to be launched via an action on github

Thanks

CodePudding user response:

You could use xunit.runner.json file:

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

And then in your csproj

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

You can also write in code

[assembly: CollectionBehavior(DisableTestParallelization = true)]
  • Related