Understanding how to add JaCoCo to the build

56 views
Skip to first unread message

oved...@gmail.com

unread,
Feb 26, 2020, 11:17:14 AM2/26/20
to JaCoCo and EclEmma Users
Hello dear community!
I'm a new to JaCoCo and into Coverage in static langues. I'm familiar with dynamic langues.
Our team uses non-java tests. Each one of them executes our tool which is written in Java. I'm trying to use Eclemma/JaCoCo in order to create the coverage report of the tests. Lets start with one test.
We compile the code with build.xml. I would like somehow to create a coverage report for each test and then to merge them into one main report. 
I found out that Jacoco has CMD interface I could use in order to merge those reports. But I don't understand how do I run the tool with coverage package?
As I said, the tests are not unit-tests written in Java, rather a bunch of shell scripts that run our tool and test it. 
As I understand, I need to compile (somehow) the code with the JaCoCo package and then run the tests on the compiled code. Each one will create a report and I'll use the CMD interface to merge them. This is the strategy.
The only problem is I don't really understand what should I add to the build.xml file.

The build in the "build.xml" file:

<target name="pde-build" depends="clean, init">
    <java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true">
        <arg value="-application" />
        <arg value="org.eclipse.ant.core.antRunner" />
        <arg value="-buildfile" />
        <arg value="${eclipseLocation}/plugins/org.eclipse.pde.build_${pdeBuildPluginVersion}/scripts/productBuild/productBuild.xml" />
        <arg value="-Dtimestamp=${timestamp}" />
        <classpath>
            <pathelement location="${eclipseLocation}/plugins/org.eclipse.equinox.launcher_${equinoxLauncherPluginVersion}.jar" />
        </classpath>
    </java>
</target>
What should I add in order to compile it with JaCoCo/Eclemma so every run will generate a coverage report?
Thanks, Robert.

Reply all
Reply to author
Forward
0 new messages