ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Enabling assertions without forking for each test. Can I fork junit itself?
Date Sat, 15 Jan 2005 13:07:30 GMT
Good day,

I'd like to have jvm assertions enabled without forking a jvm for each junit test
to speed up testing.
This might be possible by forking junit with the -ea:my.package...
option, but I don't know how to do that. 
Is it possible to fork junit itself, instead of each test case?

Or is there an easier way?

Paul Elschot

This is the junit target from the build.xml file that I'm using:
(I  added a star before the testcase name, which works nicely:
        <fileset dir="src/test" includes="**/*${testcase}.java"/>

  <target name="test" depends="compile-test" if="junit.present"
    description="Runs unit tests"
    <mkdir dir="${junit.output.dir}"/>
      <!-- jvmarg is ignored unless test.fork="yes" -->
      <jvmarg value="-enableassertions:${test.assert.package}..."/>
      <!-- <jvmarg value="-server"/> -server is slow combined with fork=yes -->
      <classpath refid="junit.classpath"/>
      <sysproperty key="dataDir" file="src/test"/> <!-- unused ?-->
      <sysproperty key="tempDir" file="${build.dir}/test"/> <!-- unused ?-->
      <formatter type="xml"/>
      <formatter type="brief" usefile="false"/>
      <batchtest fork="${test.fork}" todir="${junit.output.dir}" unless="testcase">
        <fileset dir="src/test" includes="**/Test*.java"/>
      <batchtest fork="${test.fork}" todir="${junit.output.dir}" if="testcase">
        <fileset dir="src/test" includes="**/*${testcase}.java"/>

    <fail if="tests.failed">Tests failed!</fail>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message