title: junit test and non junit test with ant target
body: <pre><code>&lt;junit printsummary="on" fork="yes" forkmode="once" 
  haltonerror="false" haltonfailure="false" 
      failureproperty="junit.failure" showoutput="false" maxmemory="1024m"&gt;
      &lt;classpath&gt;
          &lt;path refid="CLASSPATH_JUNIT"/&gt; 
          &lt;dirset dir="${TEST_BUILD_DIR}"/&gt;
      &lt;/classpath&gt;            
      &lt;batchtest fork="no"  todir="${TEST_BUILD_DIR}"&gt;
           &lt;fileset dir="${COMP_TEST_SRC}"&gt;                   
                &lt;include name="**/*Test.java" /&gt;
                &lt;include name="**/Test*.java" /&gt;
                &lt;exclude name="**/EswTestCase.java" /&gt;
           &lt;/fileset&gt;             
      &lt;/batchtest&gt;    
      &lt;formatter type="xml" /&gt;            
  &lt;/junit&gt;
  </code></pre>
  
  <p>this takes lot of time to generate xml report, and it thorws following error:</p>
  
  <pre><code>Caught an exception while logging the end of the build.  Exception was:
  java.lang.OutOfMemoryError: PermGen space
  </code></pre>
  
  <p>why it takes long time to genearte xml? how to resolve this error and make application to run fast. I have only max of 10 test files. I use command promt to execute ant script.</p>
  
  <p><strong>Analysis:</strong></p>
  
  <p>1)If i run batch test only for test calss which extends Junit test it execute very fast. eg:</p>
  
  <blockquote>
    <p>public class ImpactsParserTest extends
    <strong>TestCase</strong>{..</p>
  </blockquote>
  
  <p>2)Now if i have test class which extends spring junit test as:</p>
  
  <blockquote>
    <p>public class AddressLookupServiceTest
    extends <strong>EswTestCase</strong>{..</p>
    
    <p>public class EswTestCase extends
    <strong>AbstractDependencyInjectionSpringContextTests{..</strong></p>
  </blockquote>
  
  <p>this causes junit target to run very slowly and causes outof memory error. why itis happening like this?</p>
  
  <p>3) when I make batchtest fork="yes" instead of no, then build is quick and doesnt throw outof memory. But, it throws error like:</p>
  
  <pre><code>java.lang.NoClassDefFoundError
  at org.apache.log4j.Logger.getLogger(Logger.java:118)
  ..
  java.lang.NoClassDefFoundError: com.bgc.ordering.wizard.back.services.EswTestCase
  </code></pre>
  
  <p>even though, i have specified these jar file and class file in classpath element as:</p>
  
  <p>
  </p>
  
  <p>and logger jar in </p>
  
  <pre><code>&lt;path id="CLASSPATH_JUNIT"&gt;
     &lt;fileset dir="${BUILD_LIBS_HOME}"&gt;       
         &lt;include name="*.jar" /&gt; 
     &lt;/fileset&gt;
     &lt;pathelement location="${TEST_CLASSES_DIR}" /&gt;
     &lt;pathelement location="${TEST_BUILD_DIR}" /&gt;
     &lt;pathelement location="${COMP_BUILD}" /&gt;     
     &lt;pathelement location="${COMP_CLASSES}" /&gt;   
     &lt;path location="${APP_DIR}\bgc-esw-services\target\classes"/&gt; 
     &lt;pathelement location="${APP_DIR}\bgc-esw-web\target\classes" /&gt;
  </code></pre>
  
  <p>...</p>
  
  <p>log4j.properties present at <code>${TEST_BUILD_DIR}</code></p>
  
  <p>using: apache-ant-1.8.1 and junit-3.8.1.jar</p>