在ant 中運(yùn)行testng 的時(shí)候.一定要將testng-XX.jar放到classpath 中.我就為這折騰了兩小時(shí).疏忽大意啊。
ant-buils.xml內(nèi)容如下:
<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>