I have a jacoco-agent generated file of my Maven project (Java), named jacoco.exec
.
How can I convert this file into human readable format? (HTML/XML).
I believe that this is described in official JaCoCo documentation. In particular there is jacoco-maven-plugin goal "report" and example of its usage.
Starting from JaCoCo version 0.8.0 there is also Command Line interface. Here is an example of how to use it to produce HTML report from jacoco.exec
, note that this also requires class files:
java -jar jacoco-0.8.1/lib/jacococli.jar report jacoco.exec --classfiles directory_with_classes --html directory_for_report
In the Gradle world (for anyone who happened to stumble upon this question), use the JacocoReport
task, documented here.
The configured task would look something like this:
jacocoTestReport {
reports {
html.enabled = true
html.destination "${buildDirectory}/coverage/report/html"
xml.enabled = true
xml.destination "${buildDirectory}/coverage/report/xml"
}
executionData = files("path/to/jacoco.exec")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With