experiment with running tests in parallel within some collections
#93.273 aperta il 10 ott 2023
Metriche repository
- Star
- (17.886 star)
- Metriche merge PR
- (Merge medio 12g 11h) (661 PR mergiate in 30 g)
Descrizione
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 https://github.com/dotnet/runtime/blob/e555a0e16635c6ff2d88366f19d0781ac1fef0ee/src/libraries/Common/tests/TestUtilities/System/IO/FileCleanupTestBase.cs#L37
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
- obviously, breaking into their own classes.
- an extension point eg https://www.meziantou.net/parallelize-test-cases-execution-in-xunit.htm