Skip to content

Skip based on user-supplied exception types #3101

@AArnott

Description

@AArnott

Xunit v3 has built-in skipping support, which I'm delighted to see.

Upon closer inspection, it's not a superset of Xunit.SkippableFact yet, due to two things:

  1. Lack of a convenient Skip.If API. Maybe SkipException could itself have the If and IfNot methods on it.
  2. The FactAttribute and TheoryAttribute could add a SkipExceptions property, so that user can add additional exceptions that, if thrown from the test method, will be reported as a skip.

While no. 1 is merely a convenience, no. 2 is quite common for platform-specific test considerations. Folks will add NotSupportedException or PlatformNotSupportedException or even NotImplementedException to this list.

Without these, folks can still workaround it by adding if blocks and try/catch blocks, but it's significantly more tedious.

Sincerely,
The author of Xunit.SkippableFact, who is eager to retire it in favor of directing folks to Xunit v3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions