Edit on GitHub

xUnit1004   v2 v3   Info

Test methods should not be skipped

Cause

Tests should not be skipped long term. This analyzer highlights skipped tests for better visibility.

Reason for rule

Skipping tests should be considered a temporary mechanism, and as such, tests which are skipped are highlighted so they’re easier to see and to allow the developer to fix the issue.

How to fix violations

To fix a violation of this rule, you will typically employ one of two strategies:

Examples

Violates

using Xunit;

public class xUnit1004
{
    [Fact(Skip = "This is a flaky test")]
    public void TestMethod() { }
}

Does not violate

using Xunit;

public class xUnit1004
{
    [Fact]
    public void TestMethod() { }
}
Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.