我试图将Sonarqube与我在Android Studio上的android项目集成
我设置了以下声纳属性
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 file.xml的TEST名称,但仍然无法获得声纳的测试范围。
请帮助我摆脱这个..!
最佳答案
找到了解决方案!
我的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 /”中!