java+jenkins+testng+selenium+ant

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.