All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S1607.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

Why is this an issue?

When a test fails due, for example, to infrastructure issues, you might want to ignore it temporarily. But without some kind of notation about why the test is being ignored, it may never be reactivated. Such tests are difficult to address without comprehensive knowledge of the project, and end up polluting their projects.

This rule raises an issue for each ignored test that does not have a WorkItem attribute nor a comment about why it is being skipped on the right side of the Ignore attribute.

Noncompliant code example

[TestMethod]
[Ignore]
public void Test_DoTheThing()
{
  // ...
}

Compliant solution

[TestMethod]
[Ignore]  // renable when TCKT-1234 is fixed
public void Test_DoTheThing()
{
  // ...
}

or

[TestMethod]
[Ignore]
[WorkItem(1234)]
public void Test_DoTheThing()
{
  // ...
}

Exceptions

The rule doesn’t raise an issue if:

  • the test method is also marked with WorkItem attribute
  • there is a comment on the right side of the Ignore attribute




© 2015 - 2024 Weber Informatics LLC | Privacy Policy