Reputation: 1142
So currently I have a number of tests that are all tagged with the Parallelizable to take advantage of NUnits ability to run selenium webdriver tests in parallel.
The default amount it seems for this is 4, however I would like to reduce this number to increase stability.
Does anyone know how I can reduce this default amount? I can not seem to find anything about how to do this online.
I am hoping there is just an easy way to do this using the nunit console runner. Like a param or something
Upvotes: 0
Views: 1022
Reputation: 12295
This can be achieved, using the LevelOfParallelism Attribute
. From the documentation
This is an assembly-level attribute, which may be used to specify the level of parallelism, that is, the maximum number of worker threads executing tests in the assembly. It may be overridden using a command-line option in the console runner.
This attribute is optional. If it is not specified, NUnit uses the processor count or 2, whichever is greater. For example, on a four processor machine the default value is 4.
Example The following code, which might be placed in AssemblyInfo.cs, sets the level of parallelism to 3:
[assembly:LevelOfParallelism(3)]
Platform Support Parallel execution is supported by the NUnit framework on desktop .NET runtimes. It is not supported in our Portable or .NET Standard builds at this time, although the attributes are recognized without error in order to allow use in projects that build against multiple targets.
Documentation: https://docs.nunit.org/articles/nunit/writing-tests/attributes/levelofparallelism.html
Upvotes: 2