执行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" />
这里遇到的问题:
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.
创建任务无法成功。
解决办法:
1)http://ant-contrib.sourceforge.net/ 下载ant-contrib-1.0b3.zip
2)下载完后,解压,将ant-contrib-1.0b3.jar,放在你安装的ANT下的lib下可;
结果输出到指定位置
<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>