我试图将Sonarqube与Android Studio上的android项目集成 我设置了以下声纳属性 p>
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"
}}
Jacoco报告正在生成* .exec文件,但我收到以下警告
然而,测试用例正在传递,并且它还生成测试文件的TEST名称,但仍未获得声纳的测试覆盖率。
请帮我摆脱这个..!
答案 0 :(得分:0)
找到了解决方案!
我的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"
}
}
我所有的测试都在“src / testDebug /”中!