AkhileshSoni
AkhileshSoni

Reputation: 380

SonarQube 5.6 is not showing testcoverage report of Android project

I was trying to integrate Sonarqube with my android project on Android Studio I set The following sonar property

sonarqube {
properties {
    property "sonar.sources", "src/main"
    property "sonar.test", "src/test"
    property "sonar.java.coveragePlugin", "jacoco"
    property "sonar.jacoco.reportPath", "$buildDir/jacoco/testDebugUnitTest.exec"
    property "sonar.junit.reportsPath", "$buildDir/test-results/debug/"
    property "sonar.language", "java"
    property "sonar.sourceEncoding", "UTF-8"
    property "sonar.exclusions", "**/R.java,**/R\$*.java,src/main/gen/**/*"
    property "sonar.projectKey", "My project package"
    property "sonar.projectName", "Project Name "
    property "sonar.java.binaries", "$buildDir/intermediates/classes/debug/"
    property "sonar.java.test.binaries", "$buildDir/intermediates/classes/test/debug/"
    property "sonar.surefire.reportsPath", "$buildDir/test-results/debug"
}}

The Jacoco reports are gernerating the the *.exec files, but I am getting the following warning following warning

However the test cases are passing and also it generating the TEST-name of test file.xml but still not getting the test coverage on sonar.

Please help me to get rid out of this..!

Upvotes: 1

Views: 892

Answers (1)

sebastien
sebastien

Reputation: 76

Found the solution !

My app/build.gradle:

sonarqube {
properties {
    property "sonar.language", "java"
    property "sonar.projectKey", "testbluetooth"
    property "sonar.projectName", "testbluetooth"
    property "sonar.projectVersion", android.defaultConfig.versionName
    property "sonar.sources", "src/main/java"
    property "sonar.java.binaries", "build/intermediates/classes/debug"
    property "sonar.test", "src/testDebug/java"
    property "sonar.junit.reportsPath", "build/test-results/debug/"
    property "sonar.java.coveragePlugin", "jacoco"
    property "sonar.jacoco.reportPath", "build/jacoco/testDebugUnitTest.exec"
    property "sonar.android.lint.report", "build/outputs/lint-results-debug.xml"
}
}

All my tests are in "src/testDebug/" !

Upvotes: 1

Related Questions