JaCoCo Jenkins plugin and ant build.xml

1,162 views
Skip to first unread message

Hannu

unread,
Aug 30, 2013, 6:01:52 AM8/30/13
to jac...@googlegroups.com

Hi,
 
my boss ordered me to take jacoco tool into use...so I did but now I need some help!
 
My problem is that our junit tests are executed two times for some reason and when
JaCoCo tries to "[jacoco:coverage] Enhancing junit with coverage" second time it just hangs and
I have to abort the whole job...
 
test:
     [echo] Starting ConverterTests tests...
[jacoco:coverage] Enhancing junit with coverage
    [junit] Running test.ConverterTestsHudsonSuite
    [junit] Tests run: 210, Failures: 0, Errors: 0, Time elapsed: 347,438 sec

test:
     [echo] Starting ConverterTests tests...
[jacoco:coverage] Enhancing junit with coverage
    [junit] Running test.ConverterTestsHudsonSuite
Build was aborted
[FINDBUGS] Skipping publisher since build result is ABORTED
Recording test results
Finished: ABORTED
 
Any ideas how to gonfigure build.xml/Jacoco jenkins plugin correctly?
 - I have the latest version of jacoco(0.6.3)
 
build.xml


<project basedir="." default="build" name="ConverterTests" xmlns:jacoco="antlib:org.jacoco.ant">

<!-- Java Code Coverage -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
 
<classpath path="D:/Ohjelmakehitys/bin/jacoco-0.6.3/lib/jacocoant.jar" />
</taskdef>

<target name="test">
 
<echo message="Starting ConverterTests tests..."/>
 
<jacoco:coverage destfile="${jacoco.result.exec.file}" append="true">
   
<junit fork="true" maxmemory="1024m" printsummary="yes" forkmode="once">
   
<jvmarg value="-Xmx1024m" />
   
<jvmarg value="-XX:PermSize=256m" />
   
<jvmarg value="-XX:MaxPermSize=512m" />  
     
<jvmarg value="-Djava.awt.headless=true" />
     
<sysproperty key="WS_PATH" value="${env.WORKSPACE}"/>    
     
<test name="package.ConverterTestsHudsonSuite" todir="${junit.output.dir}"/>
     
<formatter type="xml"/>
     
<classpath refid="CDAR2ConverterTests.classpath"/>
   
</junit>
 
</jacoco:coverage>
 
</target>

<target name="report" depends="test">
 
<jacoco:report>
 
<executiondata>
   
<file file="${jacoco.result.exec.file}" />
 
</executiondata>
 
<structure name="CDAR2ConverterTests">        
   
<classfiles>
   
<fileset dir="${jacoco.src.dir}">
     
<include name="**/*.class" />
     
<exclude name="**/*Test*.class" />
     
<exclude name="**/*$*.class" />
   
</fileset>
   
</classfiles>
 
</structure>
 
<html destdir="${jacoco.result.report.dir}" />
 
</jacoco:report>
</target>

 

 

 

 

 

Marc R. Hoffmann

unread,
Sep 1, 2013, 4:12:02 AM9/1/13
to jac...@googlegroups.com
So you need to find out why it hangs. Can you please create a stack dump
from the JMV execution the JUNit tests (with JConsole)?

Also I recommend to investigate why the tests are executed twice and fix
this. If a single run already takes more than five minutes thiw ould
speed-up your build dramatically.

Cheers,
-marc

On 30.08.13 12:01, Hannu wrote:
>
> Hi,
> my boss ordered me to take jacoco tool into use...so I did but now I
> need some help!
> My problem is that our junit tests are executed two times for some
> reason and when
> JaCoCo tries to "[jacoco:coverage] Enhancing junit with coverage" second
> time it just hangs and
> I have to abort the whole job...
> *test*:
> [echo] Starting ConverterTests tests...
> [jacoco:coverage] Enhancing junit with coverage
> [junit] Running test.ConverterTestsHudsonSuite
> [junit] Tests run: 210, Failures: 0, Errors: 0, Time elapsed:
> 347,438 sec
>
> *test*:
> [echo] Starting ConverterTests tests...
> [jacoco:coverage] Enhancing junit with coverage
> [junit] Running test.ConverterTestsHudsonSuite
> Build was aborted
> [FINDBUGS] Skipping publisher since build result is ABORTED
> Recording test results
> Finished: ABORTED
> Any ideas how to gonfigure build.xml/Jacoco jenkins plugin correctly?
> - I have the latest version of jacoco(0.6.3)
> build.xml
> |
>
>
> <projectbasedir="."default="build"name="ConverterTests"xmlns:jacoco="antlib:org.jacoco.ant">
>
> <!-- Java Code Coverage -->
> <taskdefuri="antlib:org.jacoco.ant"resource="org/jacoco/ant/antlib.xml">
> <classpathpath="D:/Ohjelmakehitys/bin/jacoco-0.6.3/lib/jacocoant.jar"/>
> </taskdef>
>
> <targetname="test">
> <echomessage="Starting ConverterTests tests..."/>
> <jacoco:coveragedestfile="${jacoco.result.exec.file}"append="true">
> <junitfork="true"maxmemory="1024m"printsummary="yes"forkmode="once">
> <jvmargvalue="-Xmx1024m"/>
> <jvmargvalue="-XX:PermSize=256m"/>
> <jvmargvalue="-XX:MaxPermSize=512m"/>
> <jvmargvalue="-Djava.awt.headless=true"/>
> <syspropertykey="WS_PATH"value="${env.WORKSPACE}"/>
> <testname="package.ConverterTestsHudsonSuite"todir="${junit.output.dir}"/>
> <formattertype="xml"/>
> <classpathrefid="CDAR2ConverterTests.classpath"/>
> </junit>
> </jacoco:coverage>
> </target>
>
> <targetname="report"depends="test">
> <jacoco:report>
> <executiondata>
> <filefile="${jacoco.result.exec.file}"/>
> </executiondata>
> <structurename="CDAR2ConverterTests">
> <classfiles>
> <filesetdir="${jacoco.src.dir}">
> <includename="**/*.class"/>
> <excludename="**/*Test*.class"/>
> <excludename="**/*$*.class"/>
> </fileset>
> </classfiles>
> </structure>
> <htmldestdir="${jacoco.result.report.dir}"/>
> </jacoco:report>
> </target>
>
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages