在我的构建过程中,我非常成功地集成了Gradle (1.11)、Sonar ( 4.1.1 )、Java、Scala和Jacoco。我甚至设法获得了关于成功测试的数量的信息(感谢Stackoverflow!)。不过,我有一个问题。
我似乎无法获得每个测试的覆盖率信息。这将是非常好的有这方面的信息。
> 15:11:16.514 INFO - Sensor JaCoCoSensor... 15:11:16.535 INFO -
> Analysing C:\example\gradle-sonar-jacoco-scala\build\jacoco\test.exec
> 15:11:17.887 INFO - No information about coverage per test.
该项目的简化版本位于:https://github.com/sebastianharko/gradle-sonar-java-jacoco-scalatest-junit
干杯!
发布于 2014-02-28 21:39:46
看起来你已经有了
apply plugin: 'jacoco'
在你的gradle.build中
但是我没有看到在gradle.build中从哪里获取文件的定义
jacoco {
destinationFile = file("$buildDir/jacoco/test.exec")
}
如果您计划进行集成和单元测试,它将如下所示:
task "integtest"(type: Test, dependsOn: integtestClasses) {
testClassesDir = sourceSets.integtest.output.classesDir
classpath = sourceSets.integtest.runtimeClasspath
jacoco {
destinationFile = file("$buildDir/jacoco/integTest.exec")
}
}
test {
jacoco {
destinationFile = file("$buildDir/jacoco/test.exec")
}
}
具有相应的声纳配置项
property "sonar.jacoco.reportPath", "$buildDir/jacoco/test.exec"
property "sonar.jacoco.itReportPath", "$buildDir/jacoco/integTest.exec"
发布于 2014-02-28 22:03:53
我看到了来自SonarQube - integrationTest.exec - sonarRunner (Gradle) or "sonar-runner" command - showing 0.0% covereage的另一个配置参数:
参数sonar.java.coveragePlugin=jacoco
引起了我的注意。你试过了吗?
发布于 2014-03-06 23:46:32
您可能还想使用Coveralls.io
它非常便宜:只有4.99美元/月。你可以与Github上的pull请求(当分支增加或减少你的代码覆盖率时进行跟踪)以及a very nice UI进行深度集成,以深入了解你的代码覆盖率。
https://stackoverflow.com/questions/22028550
复制相似问题