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?
In our case, the strategy is to reassign all test cases to a new collection, and then let xUnit execute the tests. As all tests are in a different collection, xUnit will execute them in parallel. That is that simple!
xUnit.net does not require an attribute for a test class; it looks for all test methods in all public (exported) classes in the assembly. Set the Skip parameter on the [Fact] attribute to temporarily skip a test.
Luckily, dotnet test using xUnit V2 runs the tests inside of a project (or even inside a solution) in parallel by default. So at least the tests inside of a project will be started in parallel.
xunit. runner. json (where <AssemblyName> is the name of your unit test assembly, without the file extension like . dll or .exe ). You should only need to use this longer name format if your unit tests DLLs will all be placed into the same output folder, and you need to disambiguate the various configuration files.
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
}
With:
{
"diagnosticMessages": true,
"maxParallelThreads": 1
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With