Reputation: 1919
basically, in case a test takes more than 2 minutes abort that particular test and continue with others, I have this piece
<junit printsummary="yes" haltonfailure="no" haltonerror="no">
<classpath>
<pathelement path="${build.test}"/>
<path refid="project.class.path" />
</classpath>
<formatter type="plain" usefile="no"/>
<batchtest fork="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" todir="../src/result">
<fileset dir="${build.test}">
<include name="**/app/**/*Test.*"/>
<exclude name="**/app/**/*Helper*"/>
</fileset>
</batchtest>
</junit>
Upvotes: 0
Views: 232
Reputation: 45362
From junit ant doc, you have timeout
attribute :
timeout - Cancel the individual tests if they don't finish in the given time (measured in milliseconds). Ignored if fork is disabled. When running multiple tests inside the same Java VM (see forkMode), timeout applies to the time that all tests use together, not to an individual test.
<junit fork="yes" timeout="60000" >
If forkmode
is set to perTest
by default, timeout value is for each individual test, but if you specify forkmode
to once
, a single JVM will run all the tests and the value applies for all your tests.
Upvotes: 1