ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Stör <mar...@frightanic.com>
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
http://www.frightanic.com



<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" />
  </fileset>
 </path>

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


 <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"
failureProperty="test.failed">

   <classpath refid="test.classpath" />

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

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

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

  <fail if="test.failed">
       Unit tests failed.  Check log or reports for details.
${reports.tests}html/index.html
     </fail>
 </target>
</project>


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


Mime
View raw message