-
Notifications
You must be signed in to change notification settings - Fork 347
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
Test with [SkipOnTargetFramework] and [ConditionalFact] grouped as 'No Traits' in Visual Studio Test Explorer #15207
Comments
I ended up with giving up using [SkipOnTargetFramework] and [ConditionalFact], by exclude source code files from .csproj:
|
Yes, for those attributes to work, you need to filter out "failing" test attributes in your .runsettings file: https://github.com/dotnet/maintenance-packages/blob/5aba9a6630d795ce652afca2d15440b0360c50ca/eng/testing/.runsettings#L13-L14 |
See #15195 |
Should this also work with ConditionalFact? I can't seem to be able to filter those out in Test Explorer, where the SkipXXX attributes seem to work |
See dotnet/maintenance-packages#141 (comment) which lists the attributes that depend on the |
Thanks. Looks like it does not work with ConditionalFact |
Interesting. If you have time to set-up a small repro, I would be happy to take a closer look. We use that attribute a LOT in dotnet/runtime so it should work just fine in VS. |
Absolutely! Here you go: https://github.com/MichelZ/ConditionalFactNotExcludedRepro |
OK got it. Will take a look. Are they getting executed when doing a |
No, they are not,
What's nice here though is that the Conditional tests are clearly shown and marked as Skipped, which is very nice for the |
I have the following test:
which uses
RemoteExecutor
to test against AppContext switch.The test project is multi-targeting .Net Framework 462 and .Net 8.0.
I have following assembly level traits in
AssemblyInfo.cs
of the test project:The dependencies in
Directory.Build.props
if matters:The test runs as expected when targeting .Net 8.0. However when targeting .Net Framework 461, the test is displayed under 'No Traits' in Visual Studio Test Explorer and run as failed because
RemoteExecutor
is not supported by .Net Framework.Am I doing anything wrong? I'm expecting the test is completely filtered out of Test Explorer.
The text was updated successfully, but these errors were encountered: