Skip to content

experiment with running tests in parallel within some collections #93273

Open
@danmoseley

Description

@danmoseley

Our unit tests in each test assembly are divided across various classes, usually (but certainly not always) chosen to group related tests together rather than for any regard for parallelism.

Xunit's default is that each class is its own test collection (we generally do not change this) and default parallelism is between test collections, but not within them (we do limit this in some cases example)

In some (many?) cases tests within a class would be happy to run in parallel with each other. Note that classes deriving from FileCleanupTestBase ought not to be unsafe for that reason alone, if it is careful to put each test in their own folder

TestDirectory = Path.Combine(tempDirectory, "#" + GetType().Name + "_" + Path.GetRandomFileName());

Suggestion: determine whether there are large categories of tests in some test assembly or other that we can identify could safely run concurrently with others in the same class, and experiment with enabling that to see whether it materially speeds up tests.

Ways to enable that

  1. obviously, breaking into their own classes.
  2. an extension point eg https://www.meziantou.net/parallelize-test-cases-execution-in-xunit.htm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions