I am having 2 Android application that has integrated with Sonarcloud. I am writing these 2 Android applications with Kotlin and Java. I and my team have strived to have unit tests in our application. And also we are striving hard to have great code coverage for these 2 applications. So far we are measuring the code coverage by looking at Jacoco coverage in our platform.
Long story short, I and my team have paid a plan in Sonarcloud, to integrate these 2 applications. So we can have better visibility of our coverage and also our code quality.
- The first app is showing a similar coverage with Jacoco coverage. Jacoco shows 79% coverage, and Sonarcloud shows 74% coverage. And I believe it is common, since Sonarcloud has its own way to calculate coverage. And also Sonarcloud shows a similar coverage PER CLASS of this application. So I don’t have any problem with the first app.
- The second app (THE PROBLEM) is showing a very small coverage in Sonarcloud compares to the Jacoco one. Jacoco shows 66% coverage, meanwhile Sonarcloud only shows 19.7%. I have integrated with a similar way with the first app. Jacoco’s coverage exclusion and Sonarcloud’s coverage exclusion is having the same list of classes. So I am wondering why does it produce a different result? This is the screenshot of wrong coverage, and the example of a class that have a drastic difference of coverage in Jacoco and Sonarcloud:
Some classes in the Sonarcloud is showing the similar coverages with the Jacoco one. But most of the classes shows a wrong and much more smaller coverage, almost all of them are 0 coverage. In the picture, there is 1 example of the wrong coverage in a class! It shows 86% coverage in Jacoco, but shows 0% coverage in Sonarcloud.
Notes: I have integrated the all application by using sonar.coverage.jacoco.xmlReportPaths
, and enable xml jacoco report as well. I have read Jacoco XML of the second app, it reflect all the coverage that is showing in the Jacoco, but DOES NOT reflect the coverage in the Sonarcloud for some classes!
Any of you guys have experienced this problem before? Please help me with this situation, I can give more screenshots and code if needed!
Thank you in advance!