Project Quality gate Passed regardless of test coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I’m running SonarQube * Community Edition version 9.9.2 on docker. I have a Java 8 project which I built using Java 8 and I ran the analyser on Java 17. This project doesn’t have much tests and test that are there fail with different errors. Because of that I ran the analyser with -Dmaven.test.failure.ignore=true flag. Following is the project profile on SonarQube.

As you can see there are 0 test coverage. But regardless of that project overall status is “Passed”. I was expecting it to fail. What is the reason for it to be shown Passed here.

Hey there.

You mentioned SonarQube 8.9.1 but shared a SonarCloud screenshot. What is your setup in reality?

Hi Colin , Sorry that was a mistake. Earlier I used 8.9.1 because my project was Java 8 and sonar analyzer for latest didn’t ran on Java 8. Later I found out that I can run that analyzer on Java 11 and still have the project built on Java 8. So the screen shot is the latest SonarQube community image from docker. It is not cloud it is running on my local.

Thanks for the clarification.

The default Quality Gate (the Sonar Way) only concerns itself with coverage on New Code (aligning with the Clean as You Code methodology). Do you have any code represented unde New Code?

I see. No I only have the initial analysis. I wanted to get and overview of the project and was wondering why it is passed with no code coverage. Thanks for the clarification.