I had some batch of Junit tests that were taking close to 20 minutes and it was wasteful to wait everytime before checking in code, one trick I found was to use the forkmod="once" property. Using this reduce the time to 5 minute 8 sec.
<junit tempdir="build" printsummary="on" fork="yes" forkmode="once" haltonfailure="${test.haltonfailure}" failureproperty="tests.failed" showoutput="false">
Earlier Junit was forking a JVM per test and now its doing one for all test so its very fast. Here is some documentation from Junit on this property.
<junit tempdir="build" printsummary="on" fork="yes" forkmode="once" haltonfailure="${test.haltonfailure}" failureproperty="tests.failed" showoutput="false">
Earlier Junit was forking a JVM per test and now its doing one for all test so its very fast. Here is some documentation from Junit on this property.
Controls how many Java Virtual Machines get
created if you want to fork some tests. Possible values are
"perTest" (the default), "perBatch" and
"once". "once" creates only a single Java VM
for all tests while "perTest" creates a new VM for each
TestCase class. "perBatch" creates a VM for each nested
and one collecting all nested
s. Note that only tests with the same
settings of filtertrace
, haltonerror
,
haltonfailure
, errorproperty
and
failureproperty
can share a VM, so even if you set
forkmode
to "once", Ant may have to create
more than a single Java VM. This attribute is ignored for tests
that don't get forked into a new Java VM. since Ant 1.6.2
Comments
Post a Comment