> >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">
    <classpath>
      <pathelement location="${test.classes}" />
      <pathelement location=".../junit.jar" />
    </classpath>
    <formatter type="brief" usefile="false"/>
    <batchtest fork="yes">
      <fileset dir="${test.classes}">
        <include name="**/*Test.class"/>
      </fileset>
    </batchtest>
  </junit>
</target>

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
line.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to