Cesar
Cesar

Reputation: 3519

No parallel tests with xUnit DNX

I'm trying execute my tests one by one, without parallel.

I tried to configure that on my xunit.runner.json file, but without success:

{
  "maxParallelThreads": 1,
  "parallelizeAssembly": false,
  "parallelizeTestCollections": false,
  "preEnumerateTheories": false
}

What am I doing wrong?

Upvotes: 5

Views: 1479

Answers (2)

skynyrd
skynyrd

Reputation: 982

For those who are trying to disable parallelism in their .net core (>= 2.1) projects:

Create xunit.runner.json and write below:

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

Add to csproj:

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

Cheers.

Upvotes: 1

Stajs
Stajs

Reputation: 1370

I'm on dnx 1.0.0-rc1-final, xunit 2.1.0, xunit.runner.dnx 2.1.0-rc1-build204, and the maxParallelThreads setting in xunit.runner.json is working for me from the command line.

Do you have your tests separated by collections? According to the docs:

By default, each test class is a unique test collection.

So given some contrived "tests" like these, it should be easy to see if they run in parallel or not:

With:

{
    "diagnosticMessages": true,
    "maxParallelThreads":  4
}

image

With:

{
    "diagnosticMessages": true,
    "maxParallelThreads":  1
}

image

Upvotes: 8

Related Questions