SonarQube says "Not covered by tests" for most of lines

16,326

SonarQube reads code coverage reports and marks which lines have been tested (covered by tests). not covered means that those lines are not included in the code coverage reports. There are two options, your tests:

  1. don't check the code from the screen
  2. check the code from the screen, but the code coverage report:
    • didn't include data of these tests
    • has not been generated and uploaded to the server

Documentation about SonarQube Test Coverage & Execution.

Share:
16,326
Gihoon Kang
Author by

Gihoon Kang

Updated on June 04, 2022

Comments

  • Gihoon Kang
    Gihoon Kang almost 2 years

    I'm evaluating SonarQube Developer for our development team, and facing most of the lines are tagged as "Not covered by tests".

    I suppose "not covered" means "not checked or not tested". Am I guess right?

    Please let me know the exact meaning of "not covered" and why this happens.

    Below are the background info. of this evaluation.

    • SonarQube 7.3 (BuildWrapper and SonarScanner for Windows)
    • C/C++ Project using Qt 5.9

    Screenshot of SonarQube Console

  • SSD
    SSD over 3 years
    you mentioned - those lines are not included in the code coverage reports. why SonarQube did that and when SonarQube will cover these lines?. I am also facing same issue. what needs to be done to resolve?
  • agabrys
    agabrys over 3 years
    SonarQube only displays coverage results produced by other tools. You have to use a coverage tool (like JaCoCo for Java), execute it and next performs SonarScanner analysis. If the lines are covered by tests, they will be marked as covered in SonarQube UI.