ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
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?

Regards,
Paul Elschot


P.S.
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}"/>
    <junit
        printsummary="off"
        haltonfailure="${test.haltonfailure}"
        errorProperty="tests.failed"
        failureProperty="tests.failed"
    >
      <!-- 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>
      <batchtest fork="${test.fork}" todir="${junit.output.dir}" if="testcase">
        <fileset dir="src/test" includes="**/*${testcase}.java"/>
      </batchtest>
    </junit>

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message