The report generated by android project using jacoco only shows unit test coverage, not the number o

The report generated by android project using jacoco only shows unit test coverage, not the number of unit tests.

Demo url:GitHub - excellenttank/AndroidDemoForSolveSonarQubeUnitTestNumber

the command i run :gradle clean jacocoTestReportTest sonarqube

Test Execution and Test Coverage are distinct. You will need to make sure you’re generating Surefire XML-format reports and passing them to sonar.junit.reportPaths. Take note that sonar.junit.reportPaths is set by default to ${test.testResultsDir} if this is defined in your Gradle context (in which case you shouldn’t need to set anything, except to override)

Thank you for your reply

do you mean what’s in the picture below?

I set it but still nothing

Is it convenient for you to test my demo on github?

The reports generated by my two projects are the same, project one is an Android project, project two is a java project, and the package name codes inside are the same, but the test number of the Android project is not displayed, and the java project is displayed, I don’t know why

are you online?

Hey there.

What version of SonarQube are you using?

SonarQube gradle plugin in the Android project I have tried versions 2.7 and 3.3, but neither works. The version of the SonarQube server is 8.9.8

Thanks. I was suspicious for a moment you might be running a version of SonarQube that didn’t support reading test reports for Kotlin, but that’s not the case.

If you bump the gradle logs up to --info or --debug`, what do they say about the reading of the test reports?

Sensor SurefireSensor [java]
parsing [/Users/colin/Source/sonar-scanning-examples/sonarqube-scanner-gradle/gradle-basic/build/test-results/test]
Sensor SurefireSensor [java] (done) | time=40ms

I don’t understand what you said, there is no information about this in the gradle log, can you test the demo on my GitHub?

I added this parameter

property "sonar.junit.reportPaths","build/test-results/testDebugUnitTest"

And I was able to see the Unit test count in the UI.

Ideally, build/test-results/testDebugUnitTest would be the value Gradle understands as ${test.testResultsDir} – and this would require no additional configuration (or another way – the test results naturally fall into the directory defined by ${test.testResultsDir} – but I haven’t dug deeper into your project to understand why this isn’t the case.)

Thanks a lot, I added the properties “sonar.junit.reportPaths”, “build/test-results/testDebugUnitTest” and it works now

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.