SonarQube Coverage always 0%
Asked Answered
C

0

8

Tools: SonarQube Server 6.0, Sonar Scanner 3.0.3, Jenkins running on a Linux Build Slave with pipeline format, CppuTest, gcovr, Bitbucket, git, JDK 8

Problem: The Coverage measure on the sonarqube server inexplicably show 0.0% coverage, and a non-zero number for Unit Tests (shown below). The path to coverage report is accessed using sonar.cxx.coverage.reportPath=. CppuTest uses the -ojunit flag and gcov produces .gcna files that are converted to a single format using gcovr.

coverage always 0

I have manually opened the coverage-report.xml and it seems to be in the correct format (snippet):

<package branch-rate="0.0" complexity="0.0" line-rate="1.0" name="path > to unit test object file in class notation">
    <classes>
        <class branch-rate="0.0" complexity="0.0" filename="path to > source file" line-rate="1.0" name="nameOfSourceFile_cpp">
            <lines>
                <line branch="false" hits="104" number="97"/>
                <line branch="false" hits="104" number="101"/>
                <line branch="false" hits="104" number="103"/>
                <line branch="false" hits="1" number="85"/>
                <line branch="false" hits="1" number="88"/>
                <line branch="false" hits="104" number="95"/>
            </lines>
        </class>
    </classes>
</package>

The UT Coverage field on the Bitbucket Pull Request also shows 0%. I am certain that this number should be non-zero. All other aspects of SonarQube are working, including looking at CppCheck. Has anyone seen anything like this before?

Confiscable answered 23/8, 2017 at 20:9 Comment(3)
SonarQube 6.0 is not a LTS version so you should update to 6.5. Also have a look at the log files (configure the log setting in the configuration file) and look for error messages/warnings. Post your findings.Literacy
On a Q&A Site, you need to ask a question for an answer to be given. You implied question would be something along the lines of "How do I correct my SonarQube configuration to correctly show unit test coverage based on a CppuTest report?" or similar. What you actually asked (although not in the summary title) was wheter this had been observed before, which is not what I expect you want to know.Borsch
mine sonar version 7.6 still code coverage is 0%Gardia

© 2022 - 2024 — McMap. All rights reserved.