執(zhí)行testng.xml
<target name="run_tests" depends="compile">
<testng classpathref="compile.path" failureproperty="test.failed">
<!--xml test suite file -->
<xmlfileset dir="${basedir}">
<include name="testng.xml" />
</xmlfileset>
</testng>
<antcall target="sendReport" />
<fail message="ERROR: test failed!!!!!" if="test.failed" />
</target>
<taskdef resource="testngtasks" classpath="${lib.dir}/testng-6.4.jar" />
這里遇到的問(wèn)題:
1、Cause:
The name is undefined. Action:
Check the spelling. Action:
Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
創(chuàng)建任務(wù)無(wú)法成功。
解決辦法:
1)http://ant-contrib.sourceforge.net/ 下載ant-contrib-1.0b3.zip
2)下載完后,解壓,將ant-contrib-1.0b3.jar,放在你安裝的ANT下的lib下可;
結(jié)果輸出到指定位置
<target name="transform">
<xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/test-output/testng-results.xsl" out="${basedir}/test-output/index1.html" classpathref="compile.path">
<!-- you need to specify the directory here again -->
<param name="testNgXslt.outputDir" expression="${basedir}/test-output/" />
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
<!--<classpath refid="compile.path" />-->
</xslt>
</target>