Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel tests are not working when CollectionAtribute is used. #119

Closed
chrisdreams13 opened this issue Apr 21, 2024 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@chrisdreams13
Copy link

Describe the bug
Parallel tests are not working when CollectionAtribute is used.

To Reproduce
Adding CollectionAttribute to example code.

namespace Xunit.DependencyInjection.Test.Parallelization;

[CollectionDefinition(nameof(Collection), DisableParallelization = false)]
public class Collection;

[Collection(nameof(Collection))]
public class ParallelTheoryTests(ConcurrencyFixture fixture) : IClassFixture<ConcurrencyFixture>
{
    [Theory]
    [InlineData(1)]
    [InlineData(2)]
    public async Task Theory(int _) => Assert.Equal(2, await fixture.CheckConcurrencyAsync());
}

Expected behavior
Parallel test should run with and without CollectionAttribute.

Desktop:

  • OS: Win10
  • Net: 8.0.0
  • Xunit.DependencyInjection: 9.1.0
@pengweiqhca
Copy link
Owner

If [Collection], [CollectionDefinition(DisableParallelization = true)], [DisableParallelization] declared on the test class, the test class will run sequentially.

I will change the behavior if ParallelizationMode is Force

@pengweiqhca pengweiqhca added the enhancement New feature or request label Apr 22, 2024
@pengweiqhca pengweiqhca reopened this Apr 24, 2024
@pengweiqhca
Copy link
Owner

9.2.0

@chrisdreams13
Copy link
Author

Works so well, thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants