我正在使用build.xml下面来执行我的testng xml。当我只需要Selenium独立jar时,这个build.xml对我来说很好。
<project name="TestNGTest" default="test" basedir=".">
<!-- Define <testng> task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement location="SupportFiles/JarFiles/commons-cli-1.0.jar" />
<pathelement location="SupportFiles/JarFiles/commons-logging.jar" />
<pathelement location="SupportFiles/JarFiles/crimson.jar" />
<pathelement location="SupportFiles/JarFiles/hsqldb.jar" />
<pathelement location="SupportFiles/JarFiles/jaxp.jar" />
<pathelement location="SupportFiles/JarFiles/jconfig.jar" />
<pathelement location="SupportFiles/JarFiles/jmxri.jar" />
<pathelement location="SupportFiles/JarFiles/jxl.jar" />
<pathelement location="SupportFiles/JarFiles/mysql-connector-java-5.1.6-bin.jar" />
<pathelement location="SupportFiles/JarFiles/selenium-server-standalone-2.45.0.jar" />
<pathelement location="SupportFiles/JarFiles/xlSQL_Y8.jar" />
</classpath>
</taskdef>
<property name="testdir" location="bin" />
<property name="srcdir" location="src" />
<property name="libdir" location="SupportFiles" />
<property name="subdir" location="JarFiles" />
<property name="full-compile" value="true" />
<path id="classpath.base" />
<path id="classpath.test">
<!--pathelement location="${libdir}/testng-6.8.5.jar" /-->
<!--pathelement location="${subdir}/SeleniumTestNG.jar" /-->
<pathelement location="${subdir}/selenium-server-standalone-2.45.0.jar" />
<pathelement location="${subdir}/commons-cli-1.0.jar" />
<pathelement location="${subdir}/commons-logging.jar" />
<pathelement location="${subdir}/crimson.jar" />
<pathelement location="${subdir}/hsqldb.jar" />
<pathelement location="${subdir}/jaxp.jar" />
<pathelement location="${subdir}/jconfig.jar" />
<pathelement location="${subdir}/jmxri.jar" />
<pathelement location="${subdir}/jxl.jar" />
<pathelement location="${subdir}/mysql-connector-java-5.1.6-bin.jar" />
<pathelement location="${subdir}/xlSQL_Y8.jar" />
<!-- pathelement location="${libdir}/jxl-2.6.12.jar"/-->
<pathelement location="${testdir}" />
<fileset dir="${testdir}" includes="*.jar" />
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${testdir}" />
<pathelement location="${srcdir}" />
<path refid="classpath.base" />
</path>
<target name="clean">
<delete verbose="${full-compile}">
<fileset dir="${testdir}" includes="**/*.class" />
</delete>
</target>
<target name="compile" depends="clean">
<javac srcdir="${srcdir}" destdir="${testdir}" verbose="${full-compile}" fork="yes" includeantruntime="false">
<classpath refid="classpath.test" />
</javac>
</target>
<target name="test" depends="compile">
<testng outputdir="C:\Users\A592013\.jenkins\jobs\Jenkins - Selenium\workspace\test-output" classpathref="classpath.test">
<xmlfileset dir="." includes="TestNG_Sanity.xml" />
</testng>
</target>
</project>
它提供以下消息作为BUILD SUCCESSFUL,但不执行脚本。以下是详细警告信息:
[javac] C:\DurgeshProjectWork\Workspace\SeleniumWorkspace\DevOps_DIT\src\net\atos\selenium\common\XML.java:835: warning: OutputFormat is internal proprietary API and may be removed in a future release
[javac] OutputFormat format = new OutputFormat(document);
[javac] ^
[javac] C:\DurgeshProjectWork\Workspace\SeleniumWorkspace\DevOps_DIT\src\net\atos\selenium\common\XML.java:835: warning: OutputFormat is internal proprietary API and may be removed in a future release
[javac] OutputFormat format = new OutputFormat(document);
[javac]
任何人都可以告诉我的build.xml有什么问题 感谢您的帮助。只是一个FYI。我正在使用XLSQL 8读取excel数据,因此需要所有这些jar来执行此操作。 非常感谢你对此的帮助。
^