ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Stör <>
Subject [JUnit] fork mode other than "yes" ignores classpath
Date Fri, 02 Sep 2005 07:07:13 GMT
Hi all,

In my Ant script (see below) I define my own classpath via a <path> element.
Within the <junit> target I refer to it via <classpath
refid="test.classpath" />. However, JUnit seems to ignore this classpath
completely and uses ${java.class.path} only, unless I use <batchtest
fork="yes" ....
Am I doing something wrong? Is this a bug?

Marcel Stör

<project name="LoepaTest_B" default="run_junit_tests">

 <!-- This ant task is to run the current Junit-Tests available in the
package test -->
 <!-- The output will be generated in report.tests -->

 <property name="rootdir" value="C:/workspaces/eclipse/" />
 <property name="src.tests" value="${rootdir}/LoepaTest_B/" />
 <property name="reports.tests" value="C:/temp/Eahv_B/" />
 <property name="ant.home" value="C:/Programme/ApacheGroup/Ant" />

 <path id="test.classpath">
  <pathelement path="${java.class.path}" />
  <pathelement location="${rootdir}/JaXLionBase/" />
  <pathelement location="${rootdir}LoepaEahv_B/" />
  <pathelement location="${rootdir}LoepaTest_B/" />
  <pathelement location="${rootdir}LoepaWebAppEahv_B/WEB-INF/src/" />

  <fileset dir="${rootdir}/JaXLionCommonRuntimeLibs/" casesensitive="yes">
   <include name="*.jar" />

 <target name="clean">
  <mkdir dir="${reports.tests}" />
   <fileset dir="${reports.tests}">
    <include name="TEST-*.xml" />

 <target name="run_junit_tests" depends="clean">
  <echo message="Information: Die lokal ausgeführten Tests sind nicht die
selben wie auf Anthill." />
  <echo message="Auf der lokalen Workstation werden aus Zeitgründen nicht
alle Tests durchgeführt." />
  <echo message="Weitere Tests werden auf dem Build Server ausgeführt und
befinden sich im package anthill." />
  <junit haltonerror="false" showoutput="true" errorProperty="test.failed"

   <classpath refid="test.classpath" />

   <formatter type="xml" usefile="true" />

   <batchtest fork="yes" todir="${reports.tests}">
    <fileset dir="${src.tests}">
     <include name="test/**/*" />
     <exclude name="**/" />

  <junitreport todir="${reports.tests}">
   <fileset dir="${reports.tests}">
    <include name="TEST-*.xml" />
   <report format="frames" todir="${reports.tests}/html/" />

  <fail if="test.failed">
       Unit tests failed.  Check log or reports for details.

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

View raw message