How do I configure the concurrency level of XUnit when run through the the dotnet test CLI ?
I've followed the advice from this thread: XUnit dotnet test parallel threads amount
and created a xunit.runner.json file that I believe ends up in the right location, and have specified the maxParallelThreads option found here, but my tests are still being run on the default number of threads.
What am I doing wrong? A minimum repo showing what I've done which doesn't work is here: https://github.com/keyboardDrummer/concurrencyTestingExperiment
The project contains tests that only pass when all 4 of them are run concurrently, but I can't get them to fail when running them using dotnet test.
Your example is working properly -- I think
maxParallelThreadsjust works differently than you're expecting it to.Check out this GitHub issue thread, specifically this comment. I'm not sure what your goals are for concurrency in your tests, but there are some solutions shared there.
To see the
maxParallelThreadsYou can see your
maxParallelThreadsobserved if you includediagnosticMessagesset totruein yourxunit.runner.jsonand run the tests with verbose console logging:dotnet test --logger "console;verbosity=detailed"