My build script has multiple test folders configured, each containing hundreds of test cases. junit task is executed on each of these folders.'haltonfailure' and 'haltonerror' is set to false so that execution continues in case of failure.
However, once the execution of all test cases from that folder is done, the build stops (due to some tests failing from that folder) and does not continue execution of tests from remaining folders. So what I am looking for is that irrespective of which folder the test failure occurs, test cases from remaining folders should also get executed.
How can I do that (assuming I will have to retain multiple test folder structure)?
Here is the relevant ant script I have:
<target name="test">
<junit_tests />
<antcall target="generatetxtreport"/>
<antcall target="generatexmlreport"/>
<fail message="folder1 test(s) failed" if="junit.folder1.failed"/>
<fail message="folder2 test(s) failed" if="junit.folder2.failed"/>
<fail message="folder3 test(s) failed" if="junit.folder3.failed"/>
<fail message="folder4 test(s) failed" if="junit.folder4.failed"/>
<fail message="folder1 test(s) error" if="junit.folder1.error"/>
<fail message="folder2 test(s) error" if="junit.folder2.error"/>
<fail message="folder3 test(s) error" if="junit.folder3.error"/>
<fail message="folder4 test(s) error" if="junit.folder4.error"/>
</target>
<macrodef name="junit_tests">
<sequential>
<junit_test testfolder="folder1"/>
<junit_test testfolder="folder2"/>
<junit_test testfolder="folder3"/>
<junit_test testfolder="folder4"/>
</sequential>
</macrodef>
<macrodef name="junit_test">
<attribute name="testfolder"/>
<attribute name="testMode" default="once"/>
<sequential>
<junit printsummary="true"
haltonfailure="false"
haltonerror="false"
fork="on"
forkmode="@{testMode}"
failureproperty="junit.@{testfolder}.failed"
errorproperty="junit.@{testfolder}.error"
showoutput="false"
outputtoformatters="true">
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<classpath>
<path refid="some.classpath"/>
</classpath>
<batchtest todir="some.dir">
<fileset dir="some.root\@{testfolder}\">
<include name="**/Test*.class"/>
</fileset>
</batchtest>
</junit>
</sequential>
</macrodef>
failtask, i.e. at<fail message="folder1 test(s) failed" if="junit.folder1.failed"/>? - sudocode