You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Mohamed, Haneef" <Ha...@G1.com> on 2002/04/16 19:44:19 UTC
RE: jpcoverage/junit intergration: how do I capture junit coverag
e wi th with JProbe? | Addendum
The target hm that I just sent is my 'dream' target, it doesn't work.
The following illustrates my measly target that passes one arg that worked:
<target name="goodasgold">
<jpcoverage home="${jpcoveragehome}"
warnlevel="9"
recordfromstart="coverage"
snapshotdir="${build}/coverage"
workingdir="${test.classes}"
classname="junit.textui.TestRunner">
<arg value="com.g1.leslie.core.TestCommand"/>
<classpath refid="c1p.test.classpath"/>
</jpcoverage>
</target>
I'm really trying to avoid having some kind perl script to collect all the
TestClasses and feed them to
TestRunner above.
HM
-----Original Message-----
From: Mohamed, Haneef
Sent: Tuesday, April 16, 2002 1:36 PM
To: 'ant-user@jakarta.apache.org'
Subject: jpcoverage/junit intergration: how do I capture junit coverage
wi th with JProbe?
Hello everyone!
Here is the problem I am encountering:
Aim
To run junit tests and capture code coverage metrics with jprobe as part of
the build process [pre-deployment]
via ant
What I have tried
1. tried to run junit as a nested element within jpcoverage -- failed
2. tried to do an 'antcall' to run junit -- failed
3. The only thing that worked [this is my fallback position] is to pass
junit.textui.TestRunner,
one arg at a time, each TestClass, passing one arg is shown below:
<target name="hm">
<jpcoverage home="${jpcoveragehome}"
warnlevel="9"
recordfromstart="coverage" snapshotdir="${build}/coverage"
workingdir="${test.classes}"
classname="junit.textui.TestRunner">
<classpath refid="c1p.test.classpath"/>
<arg>
<filters defaultexclude="false">
<include class="*Test*" method="*"/>
</filters>
</arg>
</jpcoverage>
</target>
Notes
1. Our junit testclasses do not have a main(...), that would have made my
life a lot easier
2. I am appending the junit target at the end as well
Any suggestions would be greatly appreciated.
thanks,
Haneef Mohamed
=========
junit target
=========
<target name="test" depends="jar-test, jar-server"
description="Execute Unit Tests">
<mkdir dir="${build}/reports"/>
<junit failureProperty="junit.failed">
<classpath refid="c1p.test.classpath"/>
<formatter type="xml" />
<batchtest todir="${test.reports}">
<fileset dir="${test.classes}">
<include name="**/Test*.class" />
<exclude name="**/TestAll.class" />
<exclude name="**/Test*$$*.class" />
<exclude
name="**/*TestCase*.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${test.reports}"/>
</junitreport>
</target>