ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Olan" <ol...@computer.org>
Subject RE: JUnit reports "no tests found" but they are there
Date Fri, 13 Jun 2003 02:10:15 GMT
Matt,

I had the same problems a few weeks ago, look for a thread around 5/21 for
help, especially from Stefan Bodewig. Here's the junit target I finally got
to work:

<junit printsummary="yes" fork="true">
    <formatter type="plain" />
    <classpath >
       <pathelement location="${build.classes}"/>
    </classpath>   

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

This is in Eclipse 2.1. Note that I just installed the M1 build, and
something seriously breaks there with xerces.

Michael

> -----Original Message-----
> From: Matthew Denner [mailto:matt@denner.demon.co.uk]
> Sent: Thursday, June 12, 2003 4:54 PM
> To: user@ant.apache.org
> Subject: JUnit reports "no tests found" but they are there
> 
> 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



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


Mime
View raw message