This workspace is configured to run all three test projects in parallel in Visual Studio Test Explorer.
- Enables parallel test execution at the assembly level
MaxCpuCount=0uses all available processors to run test assemblies in parallelDisableParallelization=falseensures parallelization is enabled
Each test project contains an xunit.runner.json file with:
parallelizeAssembly: true- Allows tests from this assembly to run in parallel with other assembliesparallelizeTestCollections: true- Runs test collections within the assembly in parallelmaxParallelThreads: 0- Uses xUnit's default algorithm (processors × 2)
- Open Test Explorer (Test ? Test Explorer)
- Click the settings icon (??) in the toolbar
- Select Configure Run Settings ? Select Solution Wide runsettings File
- Browse to and select the
.runsettingsfile at the solution root
- Go to Tools ? Options
- Navigate to Test ? General
- Under Run Settings File, browse and select the
.runsettingsfile
Visual Studio will automatically detect and use .runsettings in the solution root in most cases.
After configuration, when you run all tests:
- The three test projects (UnitTests, IntegrationTests, FunctionalTests) will run in parallel
- Within each project, test collections will also run in parallel
- You should see multiple tests running simultaneously in Test Explorer
Recommended for:
- Fast unit tests (UnitTests project)
- Independent integration tests that don't share state
Use with caution for:
- Tests using shared resources (databases, files, ports)
- Tests with Testcontainers - these may need collection fixtures to control parallelization
If you encounter issues with FunctionalTests (which use Testcontainers), you may need to:
- Disable parallelization for that specific project by setting
parallelizeAssembly: falsein itsxunit.runner.json - Use xUnit Collection Fixtures to control which tests can run in parallel
- Configure Testcontainers to use unique ports/databases per test class
To disable parallel execution for a specific test project, update its xunit.runner.json:
{
"shadowCopy": false,
"parallelizeAssembly": false,
"parallelizeTestCollections": false
}To use the .runsettings file when running tests from the command line:
dotnet test --settings .runsettings