V3 Documentation
Search

Allow Tests To Run In Parallel With Themselves

Solution-level NCrunch configuration setting Default Value: True

Purpose

This setting controls whether NCrunch is allowed to execute tests within the solution in parallel with themselves. This setting only applies when parallel execution is being used.

Because of the behaviour of NCrunch's test pipeline, it is physically possible for multiple execution runs of the same test to run in parallel. This makes sense when the solution is undergoing heavy changes and test execution times are high, as it allows NCrunch to return relevant results much faster for the current version of source code, without the engine needing to wait for existing tests to finish executing against older versions of the source code.

This behaviour can introduce problems for tests that access out-of-process resources (i.e. the file system) and are not properly attributed with the ExclusivelyUsesAttribute, as the multiple execution runs of the test may interfere with each other.

Recommendations

This configuration setting should only be set to FALSE in situations where properly attributing tests with the ExclusivelyUsesAttribute is considered impractical or not feasible, and parallel execution is still required. Note that preventing tests from running in parallel with themselves is an additional constraint for the NCrunch engine that will result in slower response times.