Skip to content
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

ITestDiscovered.SkipReason is not forwarded to the TestPlatform.ObjectModel.TestCase object during discovery #422

Closed
AudreyHarradine opened this issue Oct 23, 2024 · 4 comments

Comments

@AudreyHarradine
Copy link

For context, we are using this adapter outside of the visual studio IDE as part of a command line tool that discovers tests in a Visual Studio project. It would be a real advantage during discovery to be able to see the skip reason for any tests. The SkipReason is available during discovery for the ITestDiscovered object but is lost after the creation of the TestCase.

During creation of the TestCase object it appears some ITestDiscovered values are provided as properties of the TestCase object (TestCaseUniqueID, Explicit). It would make sense to also provide the SkipReason as another property.

It appears that any change would not negatively affect the existing adapter, and it would result in not losing the original SkipReason in the TestCase.

@bradwilson
Copy link
Member

One thing that needs clarification: v3 supports unconditionally skipped tests and conditionally skipped tests. The difference is that both set Skip="...", but conditionally skipped tests also set either SkipWhen="..." or SkipUnless="...", and whether or not to skip is a decision that's made at runtime.

I'm assuming, based on your description, that you would only want us to set a SkipReason when the tests are unconditionally skipped, correct?

@AudreyHarradine
Copy link
Author

The use case described is specifically for unconditionally skipped tests.

Would the SkipWhen / SkipUnless properties make sense? Does the filtering of skipped tests happen during discovery so that the ITestDiscovered object would know whether or not it needs to be skipped, or is there another later phase that decides if those v3 test cases are skipped?

If we know for sure which cases with a skip reason aren't being skipped it could make sense to only forward the skip reason to tests which are definitely skipped.

@bradwilson
Copy link
Member

Would the SkipWhen / SkipUnless properties make sense?

Not really.

Does the filtering of skipped tests happen during discovery so that the ITestDiscovered object would know whether or not it needs to be skipped, or is there another later phase that decides if those v3 test cases are skipped?

Dynamic skip is done during execution, not discovery.

If we know for sure which cases with a skip reason aren't being skipped it could make sense to only forward the skip reason to tests which are definitely skipped.

We only know when something is definitely skipped via attribute; everything else (including a test with no skip properties set at all) could be skipped during execution. Not only do we have Skip with SkipWhen/SkipUnless, we also have Assert.Skip, .SkipWhen, and .SkipUnless.

@bradwilson
Copy link
Member

Available in 3.0.0-pre.48 https://xunit.net/docs/using-ci-builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants