在ant 中运行testng 的时候.一定要将testng-XX.jar放到classpath 中.我就为这折腾了两小时.疏忽大意啊。
ant-buils.xml内容如下:
<path id="cpath">
<pathelement location="${ant.home}/lib/testng-5.3-jdk15.jar" />
<fileset dir="E:\deploy-lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef resource="testngtasks" classpath="${ant.home}/lib/testng-5.3-jdk15.jar" />
<path id="runpath">
<path refid="cpath" />
<pathelement location="bin" />
</path>
<target name="test">
<testng classpathref="runpath" outputDir="test-output">
<jvmarg value="-ea" />
<xmlfileset dir="src/test/resources" includes="testng.xml" />
</testng>
</target>