https://github.com/AArnott/Xunit.SkippableFact
Adds Xunit dynamic skipping of facts and theories.
https://github.com/AArnott/Xunit.SkippableFact
Last synced: about 1 month ago
JSON representation
Adds Xunit dynamic skipping of facts and theories.
- Host: GitHub
- URL: https://github.com/AArnott/Xunit.SkippableFact
- Owner: AArnott
- License: other
- Created: 2015-07-20T05:16:48.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T14:13:51.000Z (about 1 month ago)
- Last Synced: 2025-03-16T21:05:13.450Z (about 1 month ago)
- Language: PowerShell
- Homepage: https://aarnott.github.io/Xunit.SkippableFact/
- Size: 990 KB
- Stars: 137
- Watchers: 5
- Forks: 13
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- stars - AArnott/Xunit.SkippableFact
README
Xunit.SkippableFact
======================[](https://github.com/AArnott/Xunit.SkippableFact/actions/workflows/build.yml)
[](https://nuget.org/packages/xunit.skippablefact)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.This package targets Xunit v2.
Xunit v3 has skipping built-in.
See [our Xunit v3 migration doc](https://aarnott.github.io/Xunit.SkippableFact/docs/xunit-v3.html).## Installation
This project is available as a [NuGet package][NuPkg]
## Usage
[Learn more at our documentation site](https://aarnott.github.io/Xunit.SkippableFact/).
Below is a sampling of uses.
Skip based on a runtime check:
```csharp
[SkippableFact]
public void SomeMoodyTest()
{
Skip.IfNot(InTheMood);
}
```Skip based on a thrown exception:
```csharp
[SkippableFact(typeof(NotSupportedException))]
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.
}
```Skip based on `SupportedOSPlatformAttribute`:
```csharp
[SkippableFact, SupportedOSPlatform("Windows")]
public void TestCngKey()
{
var key = CngKey.Create(CngAlgorithm.Rsa);
Assert.NotNull(key);
}
```## Sponsorships
[GitHub Sponsors](https://github.com/sponsors/AArnott)
[Zcash](zcash:u1vv2ws6xhs72faugmlrasyeq298l05rrj6wfw8hr3r29y3czev5qt4ugp7kylz6suu04363ze92dfg8ftxf3237js0x9p5r82fgy47xkjnw75tqaevhfh0rnua72hurt22v3w3f7h8yt6mxaa0wpeeh9jcm359ww3rl6fj5ylqqv54uuwrs8q4gys9r3cxdm3yslsh3rt6p7wznzhky7)[NuPkg]: https://www.nuget.org/packages/Xunit.SkippableFact