eclipse+Ant+testng+jenkins 持續整合環境的搭建
阿新 • • 發佈:2019-02-04
在路上,走得很慢,只要在路上就好……
1、安裝eclipse
2、安裝ant
配置環境變數
3、安裝testng
4、安裝jenkins
各項軟體都配備齊全~~~
5、生成testng.xml
6、testng.xml
7、在專案根路徑建立build.xml檔案
build.xml檔案:
<?xml version="1.0" encoding="GBK" ?>
<project name="Jenkins_selenium" default="run" basedir=".">
<echo message="${basedir}" />
<!--引入各種jar包-->
<path id="run.classpath">
<fileset dir="${basedir}">
<include name="lib/testng-6.9.6.jar" />
<include name="lib/java-client-1.2.1.jar" />
<include name="lib/jxl.jar" />
<include name="lib/mysql-connector-java-5.1.18-bin.jar" />
<include name="lib/poi-3.6-20091214.jar" />
<include name="lib/selenium-android-driver-2.3.0.jar" />
<include name="lib/selenium-java-2.44.0.jar" />
<include name="lib/selenium-java-2.44.0-srcs.jar" />
<include name="lib/selenium-server-standalone-2.44.0.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile" depends="clean">
<echo message="mkdir"/>
<mkdir dir="build/classes"/>
<!--encoding 編碼-->
<javac srcdir="src" destdir="build/classes" debug="on" encoding="GBK" includeAntRuntime="false">
<classpath refid="run.classpath"/>
</javac>
</target>
<path id="runpath">
<path refid="run.classpath"/>
<pathelement location="build/classes"/>
</path>
<!--用testng標籤,需要引入testng哦-->
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpathref="run.classpath" />
<target name="run" depends="compile">
<testng classpathref="runpath" outputdir="test-output" >
<xmlfileset dir="${basedir}" includes="testng.xml"/>
<jvmarg value="-ea" />
</testng>
</target>
</project>
8、 jenkins配置
配置JDK
配置Ant
安裝外掛:HTML Publisher plugin,可以檢視Html Report