Mad*_*Seb 5 java scala gradle jacoco sonarqube
我在构建过程中非常成功地集成了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.
Run Code Online (Sandbox Code Playgroud)
该项目的简化版本位于:https://github.com/sebastianharko/gradle-sonar-java-jacoco-scalatest-junit
干杯!
看起来你已经有了
apply plugin: 'jacoco'
Run Code Online (Sandbox Code Playgroud)
在你的 gradle.build 中
但我没有看到从 gradle.build 中获取文件的位置的定义
jacoco {
destinationFile = file("$buildDir/jacoco/test.exec")
}
Run Code Online (Sandbox Code Playgroud)
如果您计划进行集成和单元测试,它将类似于以下内容:
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")
}
}
Run Code Online (Sandbox Code Playgroud)
配合相应的声纳配置项
property "sonar.jacoco.reportPath", "$buildDir/jacoco/test.exec"
property "sonar.jacoco.itReportPath", "$buildDir/jacoco/integTest.exec"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2690 次 |
| 最近记录: |