Comments (13)
If it’s unimplementable on netcoreapp, then is it possible to make the test discoverable but always fail? Better UX.
from xunit.stafact.
Confirmed no tests found for netcoreapp1.0 - 2.2 inclusive.
from xunit.stafact.
I'm sure I've had this working, but maybe it regressed. Or maybe the dotnet CLI broke it. Have you tried running tests within VS for this same project?
from xunit.stafact.
UIFact
works.
Given my tests are not GUI related, I’d expect to be able to use StaFact
.
Edit: just saw your comment.
I only have access to dotnet test
at the moment unfortunately, but the repro is small if you have time yourself.
I haven’t looked into the internals of each Fact
variant, but UIFact
is doing it such that it works.
from xunit.stafact.
StaFactDiscoverer
only exists in Sdk.Desktop/, which is excluded for netcoreapp < 3.0 and netstandard. UIFactDiscoverer
is in Sdk/.
from xunit.stafact.
Ah, nice catch. I suspect we can't expand that support (probably some barrier got in the way), but we should look at hiding the attribute where we can't support it.
from xunit.stafact.
I’m totally ignorant about apartments, but it’s a little odd to have to use UIFact in tests for a library with no UI elements. What’s the difference between Sta and UI variants?
from xunit.stafact.
[STAFact]
just starts your test on an STA thread. That's it. It doesn't keep it there across yielding awaits either. It's analogous to [STAThread]
on your Main
method in a C# console app.
[UIFact]
arranges a SynchronizationContext
that keeps your test on the same thread across awaits. So you have a concept of a 'main thread', allowing testing of code that cares that it is only used from one thread happy (e.g. WPF).
Does that help?
from xunit.stafact.
Yes, definitely. I’m using StaFact to force xunit 2 to act like xunit 1 re: threads, as part of porting a very old project to .NET Core.
From a functionality standpoint, UIFact seems ideal for me, if a little confusingly named. I can’t think of a good alternative name except MainThreadFact? A bit long perhaps.
Final thing is just to echo your own suggestion that StaFact should not be available if the discoverer isn’t. Seems like it does a subset of the work UIFact does so it might be able to return for netcoreapp<3.0.
from xunit.stafact.
Final thing is just to echo your own suggestion that StaFact should not be available if the discoverer isn’t.
The only thing IIRC with that is that if the test library (or one it references) targets .netstandard, then we want the attribute to be present so they can apply it, even though we do not yet know whether the underlying runtime (i.e. the test project itself) will run on a platform that supports it. So I'm not sure how to bridge those two ideals.
from xunit.stafact.
What version on nuget contains this? I don’t see version match in tags vs. nuget releases.
from xunit.stafact.
I don’t see version match in tags vs. nuget releases.
I wonder what you saw there. I checked the tags and nuget releases and they appear to line up. I try to push a tag every time I push a package.
What version on nuget contains this?
None of them. I haven't released since making this fix. Just an oversight. I'll do that now.
from xunit.stafact.
It will appear as 1.0.3-beta on nuget.org
from xunit.stafact.
Related Issues (20)
- Suggestion: Skip support (SkippableFact) HOT 4
- 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
- CollectionAttribute seems to be not respected HOT 7
- [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
- WinUI Unit testing with UIFact doesn't appear to work. HOT 18
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.