2016-06-13 68 views
1

我试图Sonarqube我在Android工作室 Android项目整合我设置下面的声纳性能SonarQube 5.6没有显示Android项目的testcoverage报告

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报告gernerating的的* .exec但我收到以下警告following warning

但是,测试用例正在传递,并且它还生成测试file.xml的TEST名称,但仍未获得声纳的测试覆盖率。

请帮我摆脱这个..!

回答

0

找到解决方案!

我的应用程序/的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 /”!