Skip to content
Adds Xunit dynamic skipping of facts and theories.
Branch: master
Clone or download
AArnott Merge pull request #12 from couven92/assert
Skip tests even if SkipException is coming from within Assert.Throws
Latest commit c7f20ea Oct 3, 2018

README.md

Xunit.SkippableFact

Build status NuGet package

This project allows for Xunit tests that can determine during execution that they should report a "skipped" result. This can be useful when a precondition is not satisfied, or the test is over functionality that does not exist on the platform being tested.

Installation

This project is available as a NuGet package

Example

[SkippableFact]
public void SomeTestForWindowsOnly()
{
    Skip.IfNot(Environment.IsWindows);

    // Test Windows only functionality.
}

You can also automatically report tests as skipped based on specific exception types. This is particularly useful when the test runs against multiple target frameworks and your library is not expected to be implemented in some of them. For example:

[SkippableFact(typeof(NotSupportedException), typeof(NotImplementedException))]
public void TestFunctionalityWhichIsNotSupportedOnSomePlatforms()
{
    // Test functionality. If it throws any of the exceptions listed in the attribute,
    // a skip result is reported instead of a failure.
}
You can’t perform that action at this time.