Giter VIP home page Giter VIP logo

Comments (13)

gavinbeatty avatar gavinbeatty commented on July 4, 2024 1

If it’s unimplementable on netcoreapp, then is it possible to make the test discoverable but always fail? Better UX.

from xunit.stafact.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

Confirmed no tests found for netcoreapp1.0 - 2.2 inclusive.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

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.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

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.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

StaFactDiscoverer only exists in Sdk.Desktop/, which is excluded for netcoreapp < 3.0 and netstandard. UIFactDiscoverer is in Sdk/.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

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.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

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.

AArnott avatar AArnott commented on July 4, 2024

[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.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

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.

AArnott avatar AArnott commented on July 4, 2024

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.

gavinbeatty avatar gavinbeatty commented on July 4, 2024

What version on nuget contains this? I don’t see version match in tags vs. nuget releases.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

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.

AArnott avatar AArnott commented on July 4, 2024

It will appear as 1.0.3-beta on nuget.org

from xunit.stafact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.