You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Paul Taylor <pa...@fastmail.fm> on 2007/11/09 14:38:14 UTC

Some junit tasks fail if run in ant with forkmode="once"

Hi

If I run my junit tasks from within ant using forkmode="once" a few of 
the tests fail - if I remove the forkmode="once" option they work. I 
cant really understand why this is the case, there is File/IO involved 
in the tests
but the original files are copied as a new file for each test so cannot 
see how that they interfere with each other.

The reason why I need to use formode="once" is because Im using 
cobertura for code coverage, and it loads class information for each VM 
which takes alot longer. So with forkmode="once" my total build takes 1 
min 50 secs,
but without it takes 6 mins 20 seconds.

Anybody have any ideas, thanks paul


<target name="run.tests" depends="compile.tests" description="Run test 
cases" unless="skip.tests">
        <mkdir dir="${junitreport.dir}"/>
        <mkdir dir="${junitreport.testdatatmp.dir}"/>
        <junit fork="yes" forkmode="once" printsummary="true" 
showoutput="true">        
            <classpath location="${instrumented.dir}" />    
            <classpath refid="runtestclasspath"/>        
            <classpath refid="cobertura.classpath" />            
            <batchtest  todir="${junitreport.dir}">
                <formatter type="xml"/>                
                    <fileset dir="${testoutput.dir}">
                        <include name="**/*Test.class"/>                  
                    </fileset>
              </batchtest>
        </junit>
        
        <junitreport todir="${junitreport.dir}">
              <fileset dir="${junitreport.dir}">
                    <include name="TEST-*.xml"/>
            </fileset>
              <report format="frames" todir="${junitreport.dir}"/>
        </junitreport>
        
        <cobertura-report format="html" destdir="${coveragereport.dir}" 
srcdir="${src.dir}" />
    </target>
   

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


Re: Some junit tasks fail if run in ant with forkmode="once"

Posted by Davy Toch <Da...@belgacom.net>.
Can you show the error that is logged when you run the tests with 
forkmode="once"? Is it an OOM (OutOfMemory)?

Paul Taylor schreef:
> Hi
>
> If I run my junit tasks from within ant using forkmode="once" a few of 
> the tests fail - if I remove the forkmode="once" option they work. I 
> cant really understand why this is the case, there is File/IO involved 
> in the tests
> but the original files are copied as a new file for each test so 
> cannot see how that they interfere with each other.
>
> The reason why I need to use formode="once" is because Im using 
> cobertura for code coverage, and it loads class information for each 
> VM which takes alot longer. So with forkmode="once" my total build 
> takes 1 min 50 secs,
> but without it takes 6 mins 20 seconds.
>
> Anybody have any ideas, thanks paul
>
>
> <target name="run.tests" depends="compile.tests" description="Run test 
> cases" unless="skip.tests">
>        <mkdir dir="${junitreport.dir}"/>
>        <mkdir dir="${junitreport.testdatatmp.dir}"/>
>        <junit fork="yes" forkmode="once" printsummary="true" 
> showoutput="true">                   <classpath 
> location="${instrumented.dir}" />               <classpath 
> refid="runtestclasspath"/>                   <classpath 
> refid="cobertura.classpath" />                       <batchtest  
> todir="${junitreport.dir}">
>                <formatter type="xml"/>                
>                    <fileset dir="${testoutput.dir}">
>                        <include 
> name="**/*Test.class"/>                                     </fileset>
>              </batchtest>
>        </junit>
>               <junitreport todir="${junitreport.dir}">
>              <fileset dir="${junitreport.dir}">
>                    <include name="TEST-*.xml"/>
>            </fileset>
>              <report format="frames" todir="${junitreport.dir}"/>
>        </junitreport>
>               <cobertura-report format="html" 
> destdir="${coveragereport.dir}" srcdir="${src.dir}" />
>    </target>
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>



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