-
Notifications
You must be signed in to change notification settings - Fork 31
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
CollectionAttribute seems to be not respected #48
Comments
Interesting. I didn't think that that attribute was the responsibility of this Library. I thought Xunit itself would take care of it. I'll look into it. |
It might have been broken by one of the overrides WinFormsFact/Theory provide |
I did some quick research in how So I wrote a quick test: [Collection("A")]
public class ConcurrentClass1Tests
{
[WinFormsFact]
public void ConcurrentA()
{
Thread.Sleep(10000);
}
}
[Collection("A")]
public class ConcurrentClass2Tests
{
[WinFormsFact]
public void ConcurrentB()
{
Thread.Sleep(10000);
}
} Without the |
Thanks, I'll have another look and see if I can build a repro. One difference in scenario to your snippet: the test runs I was debugging in WinForms were on the same class. |
Thanks. I look forward to your repro.
That's not how CollectionAttribute works, at least not base don my reading of the docs. |
FWIW I just tried moving the two methods into one class and removing the Collection attribute. The VS Test Explorer still ran them one at a time, which is consistent with the xunit doc I link to. |
Thanks for looking into it and clearing up how its supposed to work, looks what I was seeing was a red herring. I was running tests from VS ("Debug test" command on a single test class) and when I did break into the debugger due to failed tests I was seeing all other methods having a thread as well. I could reproduce that but the test tasks already are on Since the test failures looked like they were comming from running tests in parallel I probably was jumping to the wrong conclusions, sorry. Can't reproduce the test failures anymore so I'm not sure what was causing them, but apparently not what I thought it was. |
WinForms has some tests that cannot be executed in parallel, the corresponding class has an attribute
[Collection("Sequential")]
which is supposed to put all test methods of that class in a collection and execute them in sequence (the name is probably irrelevant, as far as I understand its just grouping by collection name, but I didn't research this in detail)./cc @hughbe @RussKie @AArnott
The text was updated successfully, but these errors were encountered: