You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jacqui Guerrero <ja...@groxis.com> on 2003/05/15 02:33:49 UTC

JUnit JVM arguments

I am trying to pass a set of JVM arguments that need to run with a junit
test.  I am using an if condition within my <junit> task which checks if the
test class exists in my classpath.  I am doing this by checking if a
property has been set by an <available> task within a different ant target:

If task:
<target name="findtest">
    <available property="test.present" classname="my.test" >
    <classpath>
        ....
    </classpath>
</target>

Junit task:
<target name="runtest" if="test.present" depends="init, findJUnit" >
    <junit fork="on" printsummary="withOutandErr" >
        <test name="my.test" />
        <jvmarg value="-Dmyjvm.arg=somevalue">
        <jvmarg value=-Dmyotherjvm.arg=somevalue">
        ...
</target>

When I run ant against my runtest target, I do not see any of my JVM
arguments passed in - I know this because the test outputs system
properties, which are set using JVM arguments passed in.  It seems to take
the value of the current environment.  My test class uses JFCUnit constructs
and has a static block which starts a GUI program.  Is there a special
handle on running such kinds of tests in ant?

Thanks,
Jacqui