Difference between squid:S1607 and common-java:SkippedUnitTests?

We are using SonarQube 6.7 and planning to upgrade to the latest version soon.

I noticed there are two rules which look identical to me:

  • squid:S1607: Tests should not be ignored

  • common-java:SkippedUnitTests : Skipped unit tests should be either removed or fixed

Can someone explain the difference?

Thank you.

1 Like


The difference are the following:

  • Rule squid:S1607 is going to search for test methods which are marked with certains annotations, such as org.junit.Ignore or org.junit.jupiter.api.Disabled. It also checks for some other patterns which disable assertions (assumeTrue/False from junit). You can check the implementation here: SonarSource/sonar-java/…/checks/IgnoredTestsCheck.java

  • Rule common-java:SkippedUnitTests is operating at metric level, and is based on results provided by the analysis of the tests-run reports (think results such as surefire reports). From these results, we will know that some tests are skipped in a file, and then report it. You can check the implementation here: SonarSource/sonarqube/…/commonrule/SkippedTestRule.java

These two rules are then operating at different levels. You could perfectly have tests which are skipped during the testing phase (from a specific configuration), which would not be reported by the 1st rule, while the 2nd would catch them. I guess you could also have cases for the other way, when the tests are executed, but actually doing nothing (assuming true all the time for instance).

Hope this helps,

1 Like