title: Layout of Ant build.xml with junit tests
body: <p>In a project I have a folder src for all application source code and a different folder test for all junit test (both with a simular package hierarchy). </p>
  
  <p>Now I want that Ant can run all tests in in test folder, bot the problem is that now also files in the src folder with "Test" in the filename are included.</p>
  
  <p>This is the test target in the build.xml:</p>
  
  <pre><code>&lt;target name="test" depends="build"&gt;
      &lt;mkdir dir="reports/tests" /&gt;
      &lt;junit fork="yes" printsummary="yes"&gt;
        &lt;formatter type="xml"/&gt;
        &lt;classpath&gt;
          &lt;path location="${build}/WEB-INF/classes"/&gt;
          &lt;fileset dir="${projectname.home}/lib"&gt;
              &lt;include name="servlet-api.jar"/&gt;
              &lt;include name="httpunit.jar"/&gt;
              &lt;include name="Tidy.jar"/&gt;
              &lt;include name="js.jar"/&gt;
              &lt;include name="junit.jar"/&gt;
          &lt;/fileset&gt;
        &lt;/classpath&gt;
        &lt;batchtest todir="reports/tests"&gt;
          &lt;fileset dir="${build}/WEB-INF/classes"&gt;
              &lt;include name="**/*Test.class"/&gt;
          &lt;/fileset&gt;
        &lt;/batchtest&gt;
      &lt;/junit&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>And I have added the test folder to the build target:</p>
  
  <pre><code>&lt;target name="build" depends="init,init-props,prepare"&gt;
      &lt;javac source="1.5" debug="true" destdir="${build}/WEB-INF/classes"&gt;
          &lt;src path="src" /&gt;
          &lt;src path="test" /&gt;
          &lt;classpath refid="classpath"/&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  </code></pre>