meziantou / Meziantou.Xunit.ParallelTestFramework

Run xUnit test cases in parallel
MIT License
156 stars 6 forks source link

doesn't respect IClassFixture #1

Closed ellisonch closed 2 years ago

ellisonch commented 2 years ago

This package seems super cool! However, I'm having problems using it with my test classes that inherit from IClassFixture. It seems like there are two problems:

I would expect that it should instantiate the class fixture, wait for it to finish instantiating, and then run all the tests in parallel.

Edit: I'd imagine there's the same problem with ICollectionFixture, but I haven't tried it yet. Edit edit: Ah, it's bad in a different way with ICollectionFixture, as grouping things into the same explicit collection is required to use ICollectionFixture, but doing so entirely disables parallelization.

My use case: Before any tests can run, I have to set up an external resource that's slow to set up. Then I want all my tests to share that resource. I'd basically like to be able to set up that external resource once, then run ALL of my tests in parallel.

meziantou commented 2 years ago

This package creates one collection per test to enable parallelization. This has side-effect on icollectionfixture and maybe other things. I'm not sure if it's possible to fix this problem. If you have one class where you want to disable parallelism, you can create an explicit collection using the "Collection" attribute.