-
Notifications
You must be signed in to change notification settings - Fork 381
Enable ConditonalFact and ConditionalTheory for XUnit v3 #16190
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
Conversation
dotnet/runtime has many thousands of tests that use these. We do not want to be changing all of them to alternatives.
Context: dotnet/runtime#120234 (comment) |
This is definitely required, but I'm not sure it's sufficient. I haven't dug in yet, but I'm not sure the old mechanism actually skips tests in xunit3. It might just apply a category but not skip. |
I think that mechanism adds a trait, regardless of whether it's xunit 2 or 3, and it's then responsibility when running the tests to filter by traits. e.g: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it very hard for dotnet/runtime to push forward to using the more standard xunit.v3 features?
Do you mean Two reasons:
|
Yup. IIRC, the primary reason we didn't originally include these features in Arcade when I chatted with @ViktorHofer is that xunit.v3 has built-in equivalents that should be used instead. But if at this point it's too big to move, and readability is better as-is, I'm fine including the Arcade changes (if @ViktorHofer is okay with that as well). |
Also not that at least the parameterless constructor of the I haven't looked at the other constructor overloads, but probably they do encode the condition already and there is no need to throw SkipTestException in the test method. |
xunit v3 also supports SkipType+SkipWhen properties on Fact/Theory now so I think we could set those instead in our ConditionalFact/ConditionalTheory and get rid of the custom discoverers? they only support a single property name though, but I think passing multiple is somewhat rare.
Yes I agree, it doesn't make sense to still use the parameterless ctor now that we have Assert.Skip. |
It requires you to set reason, so it would be wordier.
would turn into
|
+1 |
I meant we would keep our ConditionalFact attribute but just let it set SkipType/SkipWhen and it could set some dummy Skip reason. |
Agreed. The main problem with the discoverer-based approach is that you have to pass these filters manually. The best part of the new system will be that we can just run the exe and get the results. Having to set special command line args to prevent the testing from failing partially defeats the point. |
dotnet/runtime has many thousands of tests that use these. We do not want to be changing all of them to alternatives.