java+jenkins+testng+selenium+ant
<?xml version="1.0" encoding="UTF-8"?><!--Hello是工程名,testng是最后一个target的name-->
<project name="Hello" default="testng" basedir=".">
<!-- 导入的外部包 -->
<target name="external package">
<echomessage ="第一步配置外部包"/>
<!--
<taskdef resource="testngtasks"> -->
<taskdef resource="testngtasks">
<classpath>
<pathelement location="lib/testng-5.12.jar" />
</classpath>
</taskdef>
</target>
<!-- 源文件 -->
<target name="source" depends="external package">
<echomessage ="第二步配置源文件"/>
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
</target>
<!-- 路径 -->
<target name="path" depends="source">
<echomessage ="第三步配置classpath路径"/>
<path />
<path>
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<!--<pathelement location="test" />-->
<pathelement location="${srcdir}" />
<path refid="classpath.base" />
</path>
</target>
<!-- 清理 -->
<target name="clean" depends="path">
<echomessage ="第四步配置清理"/>
<delete verbose="${full-compile}">
<fileset dir="${srcdir}" includes="**/*.class" />
</delete>
</target>
<!-- 编译 -->
<target name="compile" depends="clean">
<echomessage ="第五步配置编译"/>
<javac srcdir="${srcdir}" destdir="${srcdir}" verbose="${full-compile}" includeAntRuntime="false">
<classpath refid="classpath.test" />
</javac>
</target>
<!-- testng自动化测试 -->
<target name="testng" depends="compile">
<echomessage ="第六步配置自动化测试"/>
<!-- testoutput测试结果是输出路径 -->
<testng outputdir="testoutput"> <!-- testng.xml配置在src目录下 -->
<xmlfileset dir="${srcdir}" includes="testng.xml" />
</testng>
</target>
</project>
页:
[1]