Ant Junit tests are running much slower via ant than via IDE - what to look at?

Posted by Alex B on Stack Overflow See other posts from Stack Overflow or by Alex B
Published on 2008-09-23T19:11:14Z Indexed on 2010/06/16 18:12 UTC
Read the original article Hit count: 169

Filed under:
|
|
|

I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is:

    <junit fork="yes" forkmode="once" printsummary="off">
        <classpath refid="test.classpath"/>
        <formatter type="brief" usefile="false"/>
        <batchtest todir="${test.results.dir}/xml">
            <formatter type="xml"/>
            <fileset dir="src" includes="**/*Test.java" />
        </batchtest>
    </junit>

The same test that runs in near instantaneously in my IDE (0.067s) takes 4.632s when run through Ant. In the past, I've been able to speed up test problems like this by using the junit fork parameter but this doesn't seem to be helping in this case. What properties or parameters can I look at to speed up these tests?

More info:

I am using the reported time from the IDE vs. the time that the junit task outputs. This is not the sum total time reported at the end of the ant run.

So, bizarrely, this problem has resolved itself. What could have caused this problem? The system runs on a local disk so that is not the problem.

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance