Hi,
Versions:
SonarQube > Developer EditionVersion 9.0.1 (build 46107)
SonarScanner for Gradle plugin > 3.3
We developed Android App written in Kotlin, we can see code coverage but we are not able to get unit test numbers.
We follow the next steps:
- testStagingDebug [test for specific android variant]
- testStagingDebugUnitTestCoverage [custom task to run Jacoco]
- sonarQube
sonarqube {
androidVariant 'stagingDebug'
properties {
property "sonar.projectName", "projectName"
property "sonar.projectKey", "projectKey"
property "sonar.sources", "src/main/java"
property "sonar.tests", ["src/test/java"]
property "sonar.sourceEncoding", "UTF-8"
property "sonar.sources", "src/main/java"
property "sonar.test.inclusions", "**/*Test*/**"
property "sonar.exclusions", '**/*Test*/**,' +
'build/**' +
'*.json,' +
'**/*test*/**,' +
'**/.gradle/**,' +
'**/*Generated.java,'+
'**/R.class'
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.junit.reportPaths", "${project.projectDir}/build/test-results/testStagingDebugUnitTest/"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.projectDir}/build/reports/testStagingDebugUnitTestCoverage/*"
property "sonar.groovy.jacoco.reportPath", "${project.projectDir}/build/reports/testStagingDebugUnitTestCoverage/*"
property "sonar.coverage.exclusions", "${coverageExclusions.join(', ')}"
}
}
We try to make “sonar.junit.reportPaths” as next paths but non of them worked.
property "sonar.junit.reportPaths", "**/test-results/**/*.xml"
property "sonar.junit.reportPaths", "${project.projectDir}/build/test-results/testStagingDebugUnitTest/"
property "sonar.junit.reportPaths", "${project.projectDir}/build/test-results/testStagingDebugUnitTest/*.xml"
property "sonar.junit.reportPaths", "${project.projectDir}/build/test-results/testStagingDebugUnitTest/fullPathForOneTestResultFile.xml"
I sure now the issue only happens with Kotlin classes, I add Java class and UnitTest for this class then the SonarQube was able to update Unit Tests success but only for the Jave test.
We ask for your help to fix this issue
So what do I need to do to make sure SonarQube read the Kotlin UnitTest?
I see the same problem in the previous closed topic
[Kotlin Unit Test result not showing on SonarQube 8.5 developer] (Kotlin Unit Test result not showing on SonarQube 8.5 developer)