ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: JUnit task
Date Tue, 06 Dec 2005 15:45:00 GMT
> >That's given your basedir as a pathelement - how about giving it the
> >"testing" directory instead? Isn't that the base of the testing classes?
> But I think that is correct.
> The base dir is, say, xxx.  The testing dir sits below this with tests that
> are in the testing package.
> So sitting in my xxx dir (where I run ant from) the classpath for these
> tests is testing.MyTest1 etc.

Ah, ok. I think I see where this is going (maybe ;-). Sounds like
your <batchtest> <fileset> should be using the base base directory
as the classpath, to yield the same relative paths.

So assuming your compiled test classes are in ${basedir}/, one of them
being testing.MyTest1, corresponding to
${basedir}/testing/MyTest1.class, you should be using something along
the lines of:

<target name="test" >
  <property name="test.classes" location="." />
  <junit printsummary="withOutAndErr" showoutput="yes">
      <pathelement location="${test.classes}" />
      <pathelement location=".../junit.jar" />
    <formatter type="brief" usefile="false"/>
    <batchtest fork="yes">
      <fileset dir="${test.classes}">
        <include name="**/*Test.class"/>

Notice how I've used the same dir in the classpath and the fileset. I
didn't really need to use a property, but it makes it more obvious
these should be the same dir.

Let us know if we got this right this time. --DD

PS: It is unusual to have test code not depend on something else. It
probably means you mix test code and the production code tested, or at
least the compiled classes for both.

PPS: Compiled classes are build products. I'm very much a proponent to
have all build products go into a single directory, usually called
build/ for me, which can easily be removed with Ant or the command

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

View raw message