標籤:led local UI lib 成功 oct dtd includes 清理
1、安裝jdk7以上
2、http://mirrors.jenkins-ci.org/windows/latest 下載最新的war包
3、cmd命令在war包目錄下執行:java -jar jenkins.war
4、輸入http://localhost:8080可以開啟jenkins頁面
5、安裝TortoiseSVN,建立檔案,開啟後空白處右鍵TortoiseSVN——Create repository here,得到svn目錄
file:///D:/test/jenkins/test
6、開啟svn目錄後,直接將eclipse項目拷貝進去,在項目上右鍵SVN commint提交
7、安裝ant,配置環境變數ANT_HOME D:/ apache-ant-1.9.0 path D:/ apache-ant-1.9.0/bin classpath
D:/apache-ant-1.9.0/lib
8、ant驗證:win+R -- cmd輸入如下命令:ant
如果出現如下內容,說明安裝成功:
Buildfile: build.xml does not exist!
Build failed
說明ant安裝成功!
9、開啟http://localhost:8080,在jenkins中建立第一個自由式饒舌的項目
10、在源碼管理中選擇Subversion,輸入項目路徑:file:///D:/test/jenkins/test/testjenkins
11、構建中選擇Execute Windows... 輸入ant
12、儲存,立即構建
項目的對應build.xml和testng.xml
build.xml
如果項目只是純編譯,default設定為compile;
<?xml version="1.0" encoding="UTF-8"?><!--Hello是工程名,testng是最後一個target的name--><project name="Hello" default="testng" basedir="."> <!-- 匯入的外部包 --> <target name="external package"> <echo message ="第一步配置外部包"/>
<!-- <taskdef resource="testngtasks" classpath="lib/testng-5.12.jar"/> --> <taskdef resource="testngtasks"> <classpath> <pathelement location="lib/testng-5.12.jar" /> </classpath> </taskdef> </target> <!-- 源檔案 --> <target name="source" depends="external package"> <echo message ="第二步配置源檔案"/> <property name="srcdir" location="src" /> <property name="libdir" location="lib" /> <property name="full-compile" value="true" /> </target> <!-- 路徑 --> <target name="path" depends="source"> <echo message ="第三步配置classpath路徑"/> <path id="classpath.base" /> <path id="classpath.test"> <fileset dir="${libdir}"> <include name="**/*.jar" /> </fileset> <!--<pathelement location="test" />--> <pathelement location="${srcdir}" /> <path refid="classpath.base" /> </path> </target> <!-- 清理 --> <target name="clean" depends="path"> <echo message ="第四步配置清理"/> <delete verbose="${full-compile}"> <fileset dir="${srcdir}" includes="**/*.class" /> </delete> </target> <!-- 編譯 --> <target name="compile" depends="clean"> <echo message ="第五步配置編譯"/> <javac srcdir="${srcdir}" destdir="${srcdir}" verbose="${full-compile}" includeAntRuntime="false"> <classpath refid="classpath.test" /> </javac> </target> <!-- testng自動化測試 --> <target name="testng" depends="compile"> <echo message ="第六步配置自動化測試"/> <!-- testoutput測試結果是輸出路徑 --> <testng outputdir="testoutput" classpathref="classpath.test"> <!-- testng.xml配置在src目錄下 --> <xmlfileset dir="${srcdir}" includes="testng.xml" /> </testng> </target></project>
testng.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"><suite name="Default suite" preserve-order="true"> <test preserve-order="true" name="baidutest"> <classes> <!-- 包名+類名 --> <class name="test.ComplexCalculationTest"> <methods> <!-- 方法名 --> <include name="DivisionTest"/> <include name="MultiplyTest"/> </methods> </class> <class name="test.SimpleCalculationTest"> <methods> <include name="AddTest"/> <include name="SubtrationTest"/> </methods> </class> </classes> </test> </suite>
java+jenkins+testng+selenium+ant