The code coverage is 0.0%

I am using SonarQube 8.5 version
I have analyzed the code but every time I am getting code coverage as 0.0%

As I am new to this code coverage, I request you to provide references to solve this issue or any help in that direction is much appreciated.

Thanks and Regards,
Omkar Thadem

Hello @othadem,

Welcome to SonarSource community. :wave: :christmas_tree:. Hope you’ll like it.
Code coverage is not a concept specific to SonarQube, it’s a general development concept.
Are you aware of it ? If not, you should learn about code coverage in general (or more specifically in your development language, because it’s often a bit language specific) and then you’ll be able to look at how to integrate your code coverage in SonarQube.

Until you understand what is code coverage and you have written unit tests to produce coverage, you should simply ignore code coverage in SonarQube (accept that it is 0%)
I understand that this may fail you r quality gate. To avoid this:

  • Copy the Sonar Way quality gate into another name (eg Omkar Quality Gate)
  • Remove the criteria on code coverage from the Omkar Quality Gate
  • Set Omkar Quality Gate as the default Quality Gate

And you’re good. SonarQube will not require you to get good code coverage to pass the quality gate.

Olivier
Olivier

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.