ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Denner <m...@denner.demon.co.uk>
Subject JUnit reports "no tests found" but they are there
Date Thu, 12 Jun 2003 20:54:09 GMT
Hi,

I do my development using Eclipse and I have a build.xml file that runs 
some unittests using JUnit.  When the build.xml file is run in Eclipse 
the tests get run as expected, but the automated build system I have 
that is using Ant 1.5.3 keeps reporting "no tests found"!

I've followed the FAQ and moved the optional.jar file out of the lib 
directory.  I've used taskdef to define the junit task.  But when run 
from the command line I always see this error.  Does anybody have any 
idea why this is happening?

My environment is Redhat Linux running JDK 1.4.1, Ant 1.5.3, and the 
relevent build.xml section is:

   <!-- task.junit.defined is set in Eclipse -->
   <target name="unittest.prepare" unless="task.junit.defined">
     <taskdef name="junit" 
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
       <classpath>
         <path location="${ant.home}/optional/optional.jar"/>
       	<path refid="build.classpath.unittests"/>
       </classpath>
     </taskdef>
   </target>

   <target name="unittest" depends="compile,unittest.prepare">
     <javac destdir="${build.dir.testcode}">
       <src path="${src.dir.testcode}"/>
       <classpath>
         <path refid="build.classpath.src"/>
	<path refid="build.classpath.unittests"/>
	<pathelement location="${build.dir.classes}"/>
       </classpath>
       <include name="**/*.java"/>
     </javac>

     <junit haltonerror="yes" printsummary="yes">
       <batchtest haltonfailure="yes" haltonerror="yes">
         <fileset dir="${build.dir.testcode}">
           <include name="**/*Test.class"/>
         </fileset>
       </batchtest>
       <classpath>
         <path refid="build.classpath.src"/>
     	<path refid="build.classpath.unittests"/>
     	<pathelement location="${build.dir.classes}"/>
     	<pathelement location="${build.dir.testcode}"/>
       </classpath>
       <formatter type="plain" usefile="no"/>
     </junit>
   </target>

Matt


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


Mime
View raw message