SonarQube XML Output
If you are using SonarQube, you can get a coverage report
in a suitable XML format via the --sonarqube option:
gcovr --sonarqube coverage.xml
If the given name ends with the suffix .gz the report is compressed by gzip,
if it ends with .xz it is compressed by LZMA.
The SonarQube XML format is documented at https://docs.sonarsource.com/sonarqube-server/2025.2/analyzing-source-code/test-coverage/generic-test-data/.
Coverage Metrics
By default the coverage report contains metrics for line and branch coverage. You can adjust the metrics available in the report with the --sonarqube-metric option. The following options are available:
Option |
Description |
|---|---|
|
The generated XML contains only line coverage information |
|
The generated XML contains line and branch coverage information |
|
The generated XML contains line and branch coverage information, but the branch coverage is actually condition coverage. Requires GCC 14 or newer and the code to be compiled with |
|
The generated XML contains line and branch coverage information, but the branch coverage is actually decision coverage. Requires the option |