在我的gradle构建脚本中,我有一个部分说运行任务时生成测试报告:jacocoTestReport
jacocoTestReport {
group = "build"
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
}
当我运行任务时,它给我一个错误: 无法读取执行数据文件.. \ build \ jacoco \ test.exec 如何解决此错误。当我在整个项目上进行gradle构建时,我看到正在生成测试报告。
答案 0 :(得分:0)
您可能需要导入jacoco
插件
apply plugin: "jacoco"
我的gradle.build如下并且工作正常
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "jacoco"
repositories {
mavenCentral()
}
dependencies {
testCompile "junit:junit:4.12"
}
test {
testLogging {
exceptionFormat = 'full'
events = ["passed", "failed", "skipped"]
}
finalizedBy jacocoTestReport
}
jacocoTestReport{
group = "build"
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}