pra*_*h-g 20 gradle build.gradle
我试图使用gradle jacoco插件在spring-gradle项目中获取代码覆盖率.
build.gradle包含以下内容
apply plugin: "jacoco"
jacoco {
toolVersion = "0.7.1.201405082137"
reportsDir = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
Run Code Online (Sandbox Code Playgroud)
然后我跑了
gradle test jacocoTestReport
Run Code Online (Sandbox Code Playgroud)
仅在build/reports文件夹中生成文件test.exec之后的位置.
除此之外没有任何反应.
我怎样才能获得HTML报告?
pra*_*h-g 14
以下帮助.它的样品/测试/ jacaco of gradle-2.3-all.zip
apply plugin: "java"
apply plugin: "jacoco"
jacoco {
toolVersion = "0.7.1.201405082137"
reportsDir = file("$buildDir/customJacocoReportDir")
}
repositories {
mavenCentral()
}
dependencies {
testCompile "junit:junit:4.+"
}
test {
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpFile = file("$buildDir/jacoco/classpathdumps")
}
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
Run Code Online (Sandbox Code Playgroud)
reportsDir/destinationFile因为jacoco有默认值.
的build.gradle:
plugins {
id 'java'
id 'jacoco'
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled true
}
}
repositories {
jcenter()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Run Code Online (Sandbox Code Playgroud)
跑 gradle test jacocoTestReport
您可以在./build/reports/jacoco/test目录中找到测试报告.
HTML输出在./build/reports/jacoco/test/html目录中.
| 归档时间: |
|
| 查看次数: |
27702 次 |
| 最近记录: |