I am learning to work with Jacoco to optimize code coverage but I am having
trouble building the build file with Jacoco. I have read the tutorial at
http://www.eclemma.org/jacoco/trunk/doc/ant.html#coverage and have used
much of their sample build.xml to work on my own. Now I am getting this
error: Error while creating report. It seems fairly vague so could someone
help me figure out why this isn't working? Also the documention spoke about
the necessity to include fork="true" within the coverage section but testng
doesn't accept fork as an attribute.
<project name="Project" default="result" basedir="." xmlns:jacoco=
"antlib:org.jacoco.ant">
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="result.report.dir" location="${basedir}/report"/>
<property name="result.exec.file" location="${basedir}/jacoco.exec"/>
<target name="setClassPath">
<path id="classpath_jars">
<pathelement path="${basedir}/" />
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<pathconvert pathsep=":" property="test.classpath" refid=
"classpath_jars" />
</target>
<target name="loadTestNGAndJacoco" depends="setClassPath">
<taskdef resource="testngtasks" classpath="${test.classpath}"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path=".../jacoco-0/lib/jacocoant.jar"/>
</taskdef>
</target>
<target name="compile" depends="setClassPath">
<echo message="compiling.........."/>
<javac includeantruntime="false" destdir="${build.dir}" srcdir=
"${src.dir}" classpath="${test.classpath}"/>
</target>
<target name="test" depends="compile,setClassPath,loadTestNGAndJacoco">
<jacoco:coverage destfile="${result.exec.file}">
<testng classpath="${test.classpath}:${build.dir}">
<xmlfileset dir="${basedir}" includes="testng.xml"/>
</testng>
</jacoco:coverage>
</target>
<target name="result" depends=
"test,compile,setClassPath,loadTestNGAndJacoco">
<jacoco:report>
<executiondata>
<file file="${result.exec.file}"/>
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Report">
<classfiles>
<fileset dir="${basedir}" includes="**/*.jar"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}"/>
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}"/>
</jacoco:report>
</target>
</project>
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.