Ant's <junit> task knows two modes of operation. Run all tests inside the same Java VM that is executing Ant or fork a new Java VM for each JUnit test case class.
In general, forking a new VM is recommended since it isolates your test from Ant's environment (which contains a lot of libraries on the classloader, in particular XML related classes) but it becomes really slow because of the big overhead associated with starting new Java VMs.
A few minutes ago I've committed a change to the task that adds a new attribute, forkmode. If you set it to "once", Ant will fork a single Java VM for all your tests classes. The old behavior is forkmode="perTest" and we also have "perBatch" that generates a separate Java VM for each <batchtest> element. I expect this change to go into Ant 1.6.2 (no release date scheduled, yet).
The run-times for Ant's own test-suite on my machine show what can be gained by this:
un-forked: 7 minutes 39 seconds
forked - mode perTest: 16 minutes 2 seconds
forked - mode once: 8 minutes 36 seconds
As usual I'm not sure about the name of the attribute. Suggestions are welcome. Update the attribute's name has changed from forkstyle to forkmode.
So now I'm waiting for the next Gump run to show how many projects I've broken with this change ;-)
path: /en/Apache/Ant | #