Meziantou.Xunit.ParallelTestFramework icon indicating copy to clipboard operation
Meziantou.Xunit.ParallelTestFramework copied to clipboard

Parallel tests execution in a collection

Open iikuzmychov opened this issue 1 year ago • 0 comments

I have a very common case of testing. I have a collection fixture:

[CollectionDefinition(nameof(SomeCollection))]
public class SomeCollection : ICollectionFixture<ImmutableClass>
{
}

with some test classes:

[Collection(nameof(SomeCollection))]
public class TestClass1
{
    [Fact]
    public async Task Test1() => await Task.Delay(3000);

    [Fact]
    public async Task Test2() => await Task.Delay(3000);
}

[Collection(nameof(SomeCollection))]
public class TestClass2
{
    [Fact]
    public async Task Test3() => await Task.Delay(3000);

    [Fact]
    public async Task Test4() => await Task.Delay(3000);
}

This fixture is immutable, so I want to run each test method in the collection parallel. It should be 4 times faster. Is there any way to achieve this?

iikuzmychov avatar Sep 19 '23 17:09 iikuzmychov