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 any comment about why it is being skipped.
- For Junit4, this rule targets the @Ignore annotation.
- For Junit5, this rule targets the @Disabled annotation.
- Cases where assumeTrue(false) or assumeFalse(true) are used to skip tests are targeted as well.
Noncompliant code example
@Ignore // Noncompliant
@Test
public void testDoTheThing() {
// ...
or
@Test
public void testDoTheThing() {
Assume.assumeFalse(true); // Noncompliant
// ...
Compliant solution
@Test
@Ignore("See Ticket #1234")
public void testDoTheThing() {
// ...