Issue
I can setup spoon with:
spoon {
//...
codeCoverage true
}
to generage coverage.ec
files.
How can I generate the reports in .xml
or .html
?
Solution
You can do this creating your own task using the built-in Jacoco Gradle plugin:
apply plugin: 'jacoco'
task jacocoTestReport(type: JacocoReport, dependsOn: ['<taskThatProducesEcFile>']) {
reports {
xml.enabled true
html.enabled true
}
def fileFilter ['**/R.class', <another filters...>]
def debugTree fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc "${project.projectDir}/src/main/java"
sourceDirectories files([mainSrc])
classDirectories files([debugTree])
executionData files([<your_path_to_ec_file>])
}
Answered By – Rafael Toledo