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 20:43:34 UTC

RE: jpcoverage/junit intergration: how do I capture junit coverag e with with JProbe?

Thanks for the quick respons Gordon. I'll get busy with .reflection and post
my findings.


Haneef.

-----Original Message-----
From: Gordon Tyler [mailto:gordon.tyler@sitraka.com]
Sent: Tuesday, April 16, 2002 2:29 PM
To: Ant Users List
Subject: Re: jpcoverage/junit intergration: how do I capture junit
coverage with with JProbe?


First, a disclaimer: I work at Sitraka (who produces JProbe) but I do not
work on JProbe itself. I am part of another team at Sitraka which merely
uses JProbe Coverage with JUnit tests. So I can't give support on JProbe.

We don't use the jpcoverage or junit tasks because of the limitations that
you've pointed out but rather we execute jplauncher.exe using an <exec> task
and pass all the appropriate command-line arguments. Also, we don't execute
TestRunner directly, but rather a class which we wrote that automatically
"discovers" all the test classes in our packages and builds a TestSuite
which it then runs using TestRunner.

Here's the <exec> task that we use:

<property name="coverage.home" value="${env.COVERAGE_HOME}"/>

<exec executable="${coverage.home}/jplauncher.exe">
        <arg value="-classpath"/>
        <arg value="YOUR_CLASSPATH_HERE"/>
        <arg value="-jp_function=coverage"/>
        <arg value="-jp_java_home=${java.home}"/>
        <arg value="-jp_java_exe=${java.home}/bin/java.exe"/>
        <arg value="-jp_vm=java2"/>
        <arg value="-jp_final_snapshot=coverage"/>
        <arg value="-jp_ignore_abstract=true"/>
        <arg value="-jp_record_from_start=coverage"/>
        <arg value="-jp_output_file=YOUR_OUTPUT_FILENAME_HERE"/>
        <arg value="-jp_snapshot_dir=YOUR_SNAPSHOT_DIRECTORY_HERE"/>
        <arg value="-jp_working_dir=YOUR_BUILD_WORKING_DIRECTORY_HERE"/>
        <arg
value="-jp_filter=*.*:E,com.acme.product*.*:I,com.acme.product.AutoTest:E"/>
        <arg value="com.acme.product.AutoTest"/>
        <arg value="-o"/>
        <arg value="YOUR_LOG_FILENAME_HERE"/>
</exec>

The jp_working_dir option should point to a directory where your tests would
expect to be running from, so that they can find data files, etc. if
necessary. So in our case that would be our build/dist directory which
contains the jars and data files of our application.

The jp_filter option should be changed to use the correct includes and
excludes for your code.

com.acme.product.AutoTest is the fictional name of the "test discovery and
execution" class that I described earlier.

I don't actually use this myself, it's used by the QA guys on the team, so
I'm not 100% sure of how it all works ;) It's used in the context of a
nightly build where there isn't a human to observe it, so I don't think it
displays the Coverage UI.

Ciao,
Gordon

----- Original Message -----
From: "Mohamed, Haneef" <Ha...@G1.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, April 16, 2002 1:35 PM
Subject: jpcoverage/junit intergration: how do I capture junit coverage with
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



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>