Coverage SonarCloud Android Auzre

Hi everyone, I hope you are well.

I have the next situation with an android project and the Coverage in Sonar.

I run the Jacoco Comand “build test …” and this generate a xml report file and pass to the SonarCloudPrepare@1 task with:

extraProperties: |
sonar.coverage.jacoco.xmlReportPaths=/path/to/report.xml

And in the SonarCloudAnalyze@1 I get the next output:

However in the SonarCloud platform still appear in 0.0% Coverage

imagen

Thanks for the time and the support.
Greetings!

Hey there.

It looks like coverage is being reported (based on Estimated after Merge), but not on any of the new lines added to your Pull Request.

  • Did you write tests for any of this new code?
  • Does the (estimated after merge) figure represent what you think the code coverage of your project should be?

Thanks for the answer, Colin.

  • The tests is write (the report.xml has content for the new methods).
  • I’m not sure about that. So, how works the Sonar Coverage?

Thanks again!

And are these lines represented in the Code tab of your pull request?

I suppose what I’m asking is – based on the reports, do you expect your coverage to be closer to 15% or a higher value (15% is generally low, but if you’re only just starting to write tests for the project, might make sense).

And are these lines represented in the Code tab of your pull request?

R: Do you mean a Pull Request tab on sonar?

image

No, is not configure and this is a feature branch in a continuous integration process not ready yet to make a pull request

I suppose what I’m asking is – based on the reports, do you expect your coverage to be closer to 15% or a higher value (15% is generally low, but if you’re only just starting to write tests for the project, might make sense).

R: I’m not sure at all but I have these files to Coverage

We exclude te file MaganerTest.kt (with sonar.exclusions=/*/test//*)

Now passed the Quality Gate and only have 3 lines to coverage (I think Sonar tried to resolve the test of the test when the test folder was not excluded)

But now I have 17.7% Estimated after merge (versus the 14.7% before)<

Checking the exclude file of test I have one missing method and is alerted by Sonar. I gonna speak with the dev to add this method and uptade this thread

Thanks for your time Colin!