I'm using Jacoco with Ant to generate code coverage reports for classes from a few modules.
sourceDir/
Ant task: ...
<property name="src.dir" location="sourceDir"/>
<target name="report">
<jacoco:report>
<executiondata>
<file file="${result.exec.file}" />
</executiondata>
<structure name="JaCoCo Report">
<classfiles>
<fileset dir="${src.dir}" includes="**/target/classes/**" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" />
</jacoco:report>
</target>
Running Ant task I get a report similar to this:
Report
Would like to get something like this:
Report:
Quoting documentation at http://www.jacoco.org/jacoco/trunk/doc/ant.html :
The structure can be refined with a hierarchy of group elements. This way the coverage report can reflect different modules of a software project. For each group element the corresponding class and source files can be specified separately. For example:
<structure name="Example Project"> <group name="Server"> <classfiles> <fileset dir="${workspace.dir}/org.jacoco.example.server/classes"/> </classfiles> <sourcefiles> <fileset dir="${workspace.dir}/org.jacoco.example.server/src"/> </sourcefiles> </group> <group name="Client"> <classfiles> <fileset dir="${workspace.dir}/org.jacoco.example.client/classes"/> </classfiles> <sourcefiles> <fileset dir="${workspace.dir}/org.jacoco.example.client/src"/> </sourcefiles> </group> ... </structure>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.