SonarQube and UnitTests

Must-share information (formatted with Markdown):

  • which versions are you using: * v9.9.6 (build 92038)
  • Docker
  • what are you trying to achieve: UnitTests contribution to code coverage
  • what have you tried so far to achieve this: This is a general question

Hello, I am new to the world of SonarQube. I was wondering. If a developer has created UnitTests and we can see the UnitTests run in their Pull Request. What would be the best approach to see why it doesn’t contribute to code coverage in SonarQube? I understand that SonarQube reads a report in a Pull Request which I can see it does. But it seems to skip the developer’s code coverage. Would I open the code coverage file to validate I see the UnitTests? Or is there another mechanism to see it?

Hi and welcome to the community!

SonarQube should show code coverage for new code in your pull request.

The metric to check is “Code Coverage on New Code”.

You may be failing to import the code coverage results. Check documentation:

Best regards.