Error while creating report. Jacoco, TestNG Buildfile issue

649 views
Skip to first unread message

Michael Miller

unread,
Aug 7, 2014, 10:25:35 PM8/7/14
to jac...@googlegroups.com
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>

Marc R. Hoffmann

unread,
Aug 8, 2014, 12:57:32 AM8/8/14
to jac...@googlegroups.com
What is the full error message when you run your build with -debug?

Best regards,
-marc
--
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 jacoco+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Michael Miller

unread,
Aug 8, 2014, 1:16:10 AM8/8/14
to jac...@googlegroups.com

Buildfile: /Users/Michael/Documents/workspace/OSMSplitterTest/build.xml

setClassPath:

compile:

     [echo] compiling..........

loadTestNGAndJacoco:

test:

[jacoco:coverage] Enhancing testng with coverage

   [testng] objc[26143]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

   [testng] [TestNG] Running:

   [testng]   /Users/Michael/Documents/workspace/OSMSplitterTest/testng.xml

   [testng] org.apache.commons.cli.MissingOptionException: Missing required options: fo

   [testng] at org.apache.commons.cli.Parser.checkRequiredOptions(Parser.java:309)

   [testng] at org.apache.commons.cli.Parser.parse(Parser.java:225)

   [testng] at org.apache.commons.cli.Parser.parse(Parser.java:71)

   [testng] at javasrc.OSMSplitter.main(Unknown Source)

   [testng] at test.testNGTest.testMainWithNull(Unknown Source)

   [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

   [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

   [testng] at java.lang.reflect.Method.invoke(Method.java:483)

   [testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)

   [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)

   [testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)

   [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)

   [testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)

   [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)

   [testng] at org.testng.TestRunner.privateRun(TestRunner.java:767)

   [testng] at org.testng.TestRunner.run(TestRunner.java:617)

   [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

   [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

   [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

   [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:240)

   [testng] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

   [testng] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

   [testng] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)

   [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)

   [testng] at org.testng.TestNG.run(TestNG.java:1057)

   [testng] at org.testng.TestNG.privateMain(TestNG.java:1364)

   [testng] at org.testng.TestNG.main(TestNG.java:1333)

   [testng] Splitter initialized

   [testng] We got a file: /Users/Michael/Documents/workspace/OSMSplitterTest/planet_0.osm

   [testng] Does it exist? true

   [testng] Input Stream created

   [testng] We got a file: /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Is Directory?true

   [testng] Opening new file: planet_0.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] 1000

   [testng] Splitter initialized

   [testng] We got a file: /Users/Michael/Documents/workspace/OSMSplitterTest/planet_0.osm

   [testng] Input Stream created

   [testng] We got an output directory file: /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_0.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Splitter initialized

   [testng] We got a file: /Users/Michael/Documents/workspace/OSMSplitterTest/planet_0.osm

   [testng] Input Stream created

   [testng] We got an output directory file: /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_0.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_1.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_2.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_3.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_4.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_5.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_6.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_7.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_8.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_9.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] Opening new file: planet_10.osm in /Users/Michael/Documents/workspace/OSMSplitterTest/build

   [testng] ===============================================

   [testng] Suite

   [testng] Total tests run: 4, Failures: 0, Skips: 0

   [testng] ===============================================

result:

[jacoco:report] Loading execution data file /Users/Michael/Documents/workspace/OSMSplitterTest/jacoco.exec


BUILD FAILED

/Users/Michael/Documents/workspace/OSMSplitterTest/build.xml:39: Error while creating report


Total time: 5 seconds

leveque...@gmail.com

unread,
Aug 27, 2014, 10:43:55 AM8/27/14
to jac...@googlegroups.com
I got the same problem.
> </classfiles>...

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages