Hello,
we have problems with the code coverage displayed in Sonar Cloud for an Android project written in kotlin.
In short:
Jacoco report (XML file) is generated, but somehow it’s not uploaded to Sonar Cloud or is uploaded incorrectly - Sonar Cloud still shows 0% of the code coverage.
We use Azure DevOps pipelines as our CI.
The configuration:
- in our project we use custom jacoco gradle task for building jacoco reports,
- an output of unit tests in form of an *.exec file is generated as expected,
- the jacoco report in form of XML file is generated correctly and the coverage is not zero (see below),
<counter type="INSTRUCTION" missed="68078" covered="12314"/> <counter type="BRANCH" missed="3198" covered="306"/> <counter type="LINE" missed="11687" covered="1260"/> <counter type="COMPLEXITY" missed="5022" covered="812"/> <counter type="METHOD" missed="3354" covered="702"/> <counter type="CLASS" missed="834" covered="339"/>
- in our Azure DevOps build pipeline we have added the following tasks:
Prepare Analysis Configuration
Publish Quality Gate Result
- “Prepare Analysis Configuration” contains some advanced properties. One of them is a path to the jacoco report
sonar.coverage.jacoco.xmlReportPaths=**/reports/test* Coverage/*.xml
We are not sure if the XML file is correctly uploaded correctly - is there a possibility to preview the uploaded XML file on Sonar Cloud?
Do you have any hint what should we check? We’re running out of ideas…
Best regards,
Michał