Search code examples
nunitnunit-3.0

Nunit: Difference between ParallelScope Self+Children, Fixture+Children and All


Can someone explain the difference between different combinations of ParallelScope applied when applied to a base TestFixture (all TestFixtures in several test assemblies are derived from it):

[TestFixture, Parallelizable(ParallelScope.All)]

vs

[TestFixture, Parallelizable(ParallelScope.Fixtures | ParallelScope.Children)]

vs

[TestFixture, Parallelizable(ParallelScope.Self | ParallelScope.Children)]

Nunit documentation does not provide any clarity either. Also, there is no mention of ParallelScope.Allin NUnit documentation.

I want to run all my test cases across all test assemblies in parallel. Will it work using one of these? Is there any difference? Any advantages of using one over the other?


Solution

  • The NUnit ParallelizableAttribute only applies within a single assembly. That's because it forms part of the NUnit framework, which runs tests in a single test assembly.

    Various runner may be used to run tests in multiple assemblies. It's up to the runner to stage the individual assembly tests sequentially or in parallel.

    As an example, the NUnit Console runner, nunit3-console.exe runs multiple assemblies in parallel by default. You can use the --agents option to limit the number of assemblies run at the same time if necessary.

    When running multiple test assemblies in parallel, each assembly controls how the individual tests are parallelized via the Parallelizable attribute.