Fix nasty bug involving the build report generation when multiple test targets are specified on the same command line.

Ant immutable properties: sometimes your friend, often your enemy.
This commit is contained in:
David Roazen 2011-09-09 12:04:41 -04:00
parent 60a3618845
commit 6bd8a53efd
1 changed files with 15 additions and 18 deletions

View File

@ -821,6 +821,7 @@
<!-- TEST --> <!-- TEST -->
<macrodef name="run-test"> <macrodef name="run-test">
<attribute name="testtype"/> <attribute name="testtype"/>
<attribute name="outputdir"/>
<attribute name="runfailed"/> <attribute name="runfailed"/>
<sequential> <sequential>
@ -828,10 +829,6 @@
<equals arg1="@{runfailed}" arg2="true"/> <equals arg1="@{runfailed}" arg2="true"/>
</condition> </condition>
<condition property="test.output.dir" value="${report}/@{testtype}" else="${report}/failed_rerun">
<not><isset property="run.failed.tests"/></not>
</condition>
<!-- Get the pipeline run type. Default to dry. --> <!-- Get the pipeline run type. Default to dry. -->
<condition property="pipeline.run" value="dry" else="${pipeline.run}"> <condition property="pipeline.run" value="dry" else="${pipeline.run}">
<equals arg1="${pipeline.run}" arg2="$${pipeline.run}" /> <equals arg1="${pipeline.run}" arg2="$${pipeline.run}" />
@ -841,10 +838,10 @@
<isset property="include.contracts" /> <isset property="include.contracts" />
</condition> </condition>
<mkdir dir="${test.output.dir}"/> <mkdir dir="@{outputdir}"/>
<echo message="Sting: Running @{testtype} test cases!"/> <echo message="Sting: Running @{testtype} test cases!"/>
<taskdef resource="testngtasks" classpath="${testng.jar}"/> <taskdef resource="testngtasks" classpath="${testng.jar}"/>
<testng outputDir="${test.output.dir}" <testng outputDir="@{outputdir}"
haltOnFailure="false" failureProperty="test.failure" haltOnFailure="false" failureProperty="test.failure"
verbose="2" verbose="2"
workingDir="${basedir}" workingDir="${basedir}"
@ -885,11 +882,11 @@
</testng> </testng>
<!-- generate a report for Bamboo or Hudson to read in --> <!-- generate a report for Bamboo or Hudson to read in -->
<junitreport todir="${test.output.dir}"> <junitreport todir="@{outputdir}">
<fileset dir="${test.output.dir}"> <fileset dir="@{outputdir}">
<include name="*/*.xml"/> <include name="*/*.xml"/>
</fileset> </fileset>
<report format="noframes" todir="${test.output.dir}"/> <report format="noframes" todir="@{outputdir}"/>
</junitreport> </junitreport>
<fail message="test failed" if="test.failure" /> <fail message="test failed" if="test.failure" />
@ -913,7 +910,7 @@
<condition property="ttype" value="*UnitTest" else="${single}"> <condition property="ttype" value="*UnitTest" else="${single}">
<not><isset property="single"/></not> <not><isset property="single"/></not>
</condition> </condition>
<run-test testtype="${ttype}" runfailed="false"/> <run-test testtype="${ttype}" outputdir="${report}/${ttype}" runfailed="false"/>
</target> </target>
<target name="test.public" depends="init.buildpublic,test"/> <target name="test.public" depends="init.buildpublic,test"/>
@ -921,7 +918,7 @@
<condition property="itype" value="*IntegrationTest" else="${single}"> <condition property="itype" value="*IntegrationTest" else="${single}">
<not><isset property="single"/></not> <not><isset property="single"/></not>
</condition> </condition>
<run-test testtype="${itype}" runfailed="false"/> <run-test testtype="${itype}" outputdir="${report}/${itype}" runfailed="false"/>
</target> </target>
<target name="integrationtest.public" depends="init.buildpublic,integrationtest"/> <target name="integrationtest.public" depends="init.buildpublic,integrationtest"/>
@ -929,7 +926,7 @@
<condition property="ptype" value="*PerformanceTest" else="${single}"> <condition property="ptype" value="*PerformanceTest" else="${single}">
<not><isset property="single"/></not> <not><isset property="single"/></not>
</condition> </condition>
<run-test testtype="${ptype}" runfailed="false"/> <run-test testtype="${ptype}" outputdir="${report}/${ptype}" runfailed="false"/>
</target> </target>
<target name="performancetest.public" depends="init.buildpublic,performancetest" /> <target name="performancetest.public" depends="init.buildpublic,performancetest" />
@ -937,7 +934,7 @@
<condition property="pipetype" value="*PipelineTest" else="${single}"> <condition property="pipetype" value="*PipelineTest" else="${single}">
<not><isset property="single"/></not> <not><isset property="single"/></not>
</condition> </condition>
<run-test testtype="${pipetype}" runfailed="false"/> <run-test testtype="${pipetype}" outputdir="${report}/${pipetype}" runfailed="false"/>
</target> </target>
<target name="pipelinetest.public" depends="init.buildpublic,pipelinetest" /> <target name="pipelinetest.public" depends="init.buildpublic,pipelinetest" />
@ -946,24 +943,24 @@
<condition property="pipetype" value="*PipelineTest" else="${single}"> <condition property="pipetype" value="*PipelineTest" else="${single}">
<not><isset property="single"/></not> <not><isset property="single"/></not>
</condition> </condition>
<run-test testtype="${pipetype}" runfailed="false"/> <run-test testtype="${pipetype}" outputdir="${report}/${pipetype}" runfailed="false"/>
</target> </target>
<target name="pipelinetestrun.public" depends="init.buildpublic,pipelinetestrun" /> <target name="pipelinetestrun.public" depends="init.buildpublic,pipelinetestrun" />
<target name="failed-test" depends="init.buildall,test.compile"> <target name="failed-test" depends="init.buildall,test.compile">
<run-test testtype="${report}/*UnitTest/testng-failed.xml" runfailed="true"/> <run-test testtype="${report}/*UnitTest/testng-failed.xml" outputdir="${report}/failed_rerun" runfailed="true"/>
</target> </target>
<target name="failed-integration" depends="init.buildall,test.compile"> <target name="failed-integration" depends="init.buildall,test.compile">
<run-test testtype="${report}/*IntegrationTest/testng-failed.xml" runfailed="true"/> <run-test testtype="${report}/*IntegrationTest/testng-failed.xml" outputdir="${report}/failed_rerun" runfailed="true"/>
</target> </target>
<target name="failed-performance" depends="init.buildall,test.compile"> <target name="failed-performance" depends="init.buildall,test.compile">
<run-test testtype="${report}/*PerformanceTest/testng-failed.xml" runfailed="true"/> <run-test testtype="${report}/*PerformanceTest/testng-failed.xml" outputdir="${report}/failed_rerun" runfailed="true"/>
</target> </target>
<target name="failed-pipeline" depends="init.buildall,test.compile"> <target name="failed-pipeline" depends="init.buildall,test.compile">
<run-test testtype="${report}/*PipelineTest/testng-failed.xml" runfailed="true"/> <run-test testtype="${report}/*PipelineTest/testng-failed.xml" outputdir="${report}/failed_rerun" runfailed="true"/>
</target> </target>
<!-- ******************************************************************************** --> <!-- ******************************************************************************** -->