You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joel Hockey <jo...@hotmail.com> on 2004/02/09 01:19:01 UTC

junit batchtest using a single testsuite

I am currently using the junit batchtest task to test some classes that use 
Hibernate.  Each test class causes Hibernate to load its config which takes 
about 4 seconds.  This is a bit of a pain

Its seems like batchtest creates a TestSuite for each class and runs them 
each in a different classloader (or at least clears the classloader before 
running each class).

Is there a way for batchtest to create only 1 testsuite from all tests, and 
then run it all within the same classloader?

I have searched the archives and found a few references where people have 
solved this by writing they own 'DynamicTestSuite' implementation.  Just 
wondering if this functionality was available in the core?

http://marc.theaimsgroup.com/?l=ant-user&m=103538945519143&w=2
http://marc.theaimsgroup.com/?l=ant-dev&m=98098252202392&w=2

  <target name="test" depends="compile,hibernate" description="run junit 
tests">
    <echo>Running junit tests</echo>
    <junit printSummary="true" fork="yes" haltonfailure="yes">
      <classpath>
        <path location="build/classes" />
        <path location="build/test-classes" />
        <path refid="classpath" />
      </classpath>
      <formatter type="xml"/>
      <formatter type="plain" usefile="false"/>
      <batchtest todir="build/report">
        <fileset dir="build/test-classes" 
includes="**/${test.pattern}Test.class" />
      </batchtest>
    </junit>


Thanks, Joel

_________________________________________________________________
Protect your inbox from harmful viruses with new ninemsn Premium. Click here 
  http://ninemsn.com.au/premium/landing.asp


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org