Generating coverage using multiple jacoco xml and exec reports

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

6.7 and 7.9

  • what are you trying to achieve

I want to generate coverage using multiple jacoco reports. Different tests will generate different jacoco report. I want to import all these multiple jacoco reports in sonarqube and get coverage percentage.

  • what have you tried so far to achieve this

Except coverage, code has been imported in sonarqube. Tried to get jacoco reports using jacoco.coverage.xmlreports but it did not work.

Hi,

Welcome to the community!

I’m not sure where you found that parameter. The docs list the one you want as sonar.coverage.jacoco.xmlReportPaths.

In general, if it doesn’t start with sonar. then it’s probably not a SonarQube analysis parameter.

 
:slight_smile:
Ann

Hi,

I have configured sonar to import jacoco reports as below

sonar.coverage.jacoco.xmlReportPaths=coverage/report.xml

I want to know, if i have multiple jacoco reports generated as report1.xml,report2.xml,report3.xml, how can i pass multiple jacoco reports to sonar.

Hi,

Have you checked the docs?

 
:slight_smile:
Ann

I could not find it on docs? If you can point me in the right direction that would be great.

Hi,

In the docs link I gave you earlier, it says

sonar.coverage.jacoco.xmlReportPaths Path to JaCoCo XML coverage reports.

Perhaps it’s a bit subtle, but the ‘s’ on “coverage reports” (and on xmlReportPaths) indicates that the parameter accepts multiple values.

 
Ann

Is it really working if we assign multiple value(separated by coma) to sonar.coverage.jacoco.xmlReportPaths?

Hi,

Welcome to the community!

That’s how it’s supposed to work. Let us know if you experience something different.

 
Ann

Hi guys, same issue for me((
Just dont understand what i do wrong.
The issue is that if i put reports like this:
property “sonar.coverage.jacoco.xmlReportPaths” ,“module1/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml, module2/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml, module/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml”
sonar displays only for the module1 test reports.

Is there any ideas?

Max.

Hi Max,

Welcome to the community!

Your analysis logs might be helpful here. What, if anything do they say about your coverage reports?

 
Ann

3 posts were split to a new topic: Importing multiple reports