Junit test and test without junit with ant target

<junit printsummary="on" fork="yes" forkmode="once" 
haltonerror="false" haltonfailure="false" 
    failureproperty="junit.failure" showoutput="false" maxmemory="1024m">
    <classpath>
        <path refid="CLASSPATH_JUNIT"/> 
        <dirset dir="${TEST_BUILD_DIR}"/>
    </classpath>            
    <batchtest fork="no"  todir="${TEST_BUILD_DIR}">
         <fileset dir="${COMP_TEST_SRC}">                   
              <include name="**/*Test.java" />
              <include name="**/Test*.java" />
              <exclude name="**/EswTestCase.java" />
         </fileset>             
    </batchtest>    
    <formatter type="xml" />            
</junit>

it takes a long time to generate an xml report, and this indicates the following error:

Caught an exception while logging the end of the build.  Exception was:
java.lang.OutOfMemoryError: PermGen space

Why does xml generation take a lot of time? How to fix this error and make the application work fast. I have only 10 test files. I use the promt command to execute an ant script.

Analysis:

1) If I run the batch test only for test calss, which extends the Junit test, it runs very quickly. eg:

Public class ImpactsParserTest extends TestCase {..

2) Now, if I have a test class that extends spring junit test as:

public class AddressLookupServiceTest extends EswTestCase {..

EswTestCase AbstractDependencyInjectionSpringContextTests {..

. ?

3), batchtest fork = "yes" no, . , :

java.lang.NoClassDefFoundError
at org.apache.log4j.Logger.getLogger(Logger.java:118)
..
java.lang.NoClassDefFoundError: com.bgc.ordering.wizard.back.services.EswTestCase

jar classpath :

<path id="CLASSPATH_JUNIT">
   <fileset dir="${BUILD_LIBS_HOME}">       
       <include name="*.jar" /> 
   </fileset>
   <pathelement location="${TEST_CLASSES_DIR}" />
   <pathelement location="${TEST_BUILD_DIR}" />
   <pathelement location="${COMP_BUILD}" />     
   <pathelement location="${COMP_CLASSES}" />   
   <path location="${APP_DIR}\bgc-esw-services\target\classes"/> 
   <pathelement location="${APP_DIR}\bgc-esw-web\target\classes" />

...

log4j.properties ${TEST_BUILD_DIR}

: apache- ant -1.8.1 junit-3.8.1.jar

+3
1

, JVM . . PermGen. , ( ) . , . : -XX:MaxPermSize. - 64 Sun. , , 256 .

, , , . , Spring, . EswTestCase. , , . , Spring.

, JavaDoc AbstractDependencyInjectionSpringContextTests:

, . Spring : POJO JUnit!

Spring 3.0, JUnit 3.8 (.. AbstractDependencyInjectionSpringContextTests, AbstractTransactionalDataSourceSpringContextTests ..) . Spring TestContext Framework. EswTestCase AbstractDependencyInjectionSpringContextTests .

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class EswTestCase 
{
    ...
}
+3

All Articles