Comments (7)
Thanks. I look forward to your repro.
One difference in scenario to your snippet: the test runs I was debugging in WinForms were on the same class.
That's not how CollectionAttribute works, at least not base don my reading of the docs.
Per my reading, tests within a class never run in parallel anyway (given default behavior anyway). The CollectionAttribute
allows you to extend that non-concurrency across multiple classes, as in my example.
from xunit.stafact.
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.
from xunit.stafact.
It might have been broken by one of the overrides WinFormsFact/Theory provide
from xunit.stafact.
I did some quick research in how CollectionAttribute
works and don't see any correlation to the test discovery system.
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 Collection
attribute on the test classes, Test Explorer in VS configured to run tests in parallel will run these two tests in parallel. But with the Collection
attribute, only one test runs at a time. So I can't repro the problem you're describing.
from xunit.stafact.
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.
from xunit.stafact.
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.
from xunit.stafact.
That's not how CollectionAttribute works, at least not base don my reading of the docs.
Per my reading, tests within a class never run in parallel anyway (given default behavior anyway).
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 RanToCompletion
so I assume you report success back to Xunit before you terminate the threads.
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.
from xunit.stafact.
Related Issues (20)
- Add UITheory and StaTheory HOT 8
- StaTheory does not work with MemberDataAttribute HOT 2
- [StaFact] tests not found when used with netcoreapp2.2 HOT 13
- StaTheory is not supported in Visual Studio Runner HOT 13
- Support for OleInitialize HOT 2
- WPF support on .NET Core 3.0 breaks .NET Core 3.0 consumers on Linux/Mac
- Can't run tests HOT 2
- Generate test arguments on test thread
- CPU usage in polling message loop HOT 4
- Hanging UITheoryTestCase
- Clarify attribute names, or rename package ID HOT 8
- [StaFact] tests do not execute when targeting net462 HOT 8
- .net 4.5.2 compatibility HOT 3
- netstandard support HOT 1
- STA for Fixture Collections HOT 5
- StaFact facts breaks the concurrency limitations of Xunit HOT 11
- Running all tests within a class on the same thread? HOT 12
- [MainThreadFact] to execute tests on main thread on macos HOT 6
- Custom Thread HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xunit.stafact.