Unit test 0 coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) Enterprise Edition 9.9.8 LTA
  • how is SonarQube deployed: zip
  • what are you trying to achieve: This is coming from the user’s perspective: One reported that they are getting a unit test coverage of 0% and mentioned that the service (or probably they meant that the code actually has > 80% coverage. Please help us understand why the scan result shows there’s no unit tests found.
  • what have you tried so far to achieve this - Checked the sonar part of their build logs and the latest build says that quality gate has failed. Am I correct that the developers need to fix this quality gate before unit test coverage gets bumped into something not zero?


Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

9.9.8 → 2025.1.1-> 2025.2 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, according to your screenshot you’ll need to review the Security Hotspots and fix the coverage in order to pass the Quality Gate, not the other way around.

If your problems persists after upgrade, please come back to us.

 
Ann

And once this is done, that’s the time that we will be able to see values back in unit test coverage?

Also, do you have any guide on how to review the security hotspots and fixing the coverage - is this something that is being configured in the Sonarqube UI? Or is this something that the developer needs to do in their side (their way of programming)?

Hi,

Upgrading won’t fix your missing coverage. But I can’t help you with 9.9.8.

The docs should help.

 
HTH,
Ann

what I mean is once the security hotspots have been addressed, the developer should be able to see values in their unit test coverage?

Hi,

Once the Security Hotspots have been reviewed, you’ll still need to tackle why your coverage is at 0%.

 
Ann