TESTNG+JENKINS持續集成


一、環境搭建

  1. 安裝testNG插件到eclipse.
    -) 選擇菜單 Help /Software updates / Find and Install.
    -) 點擊add button然后在location中輸入http://beust.com/eclipse/
    -) 確定后會自動安裝testNG插件。
    二.包的引入
    WebDriver包:selenium-server-standalone.jar

    testng 包: testng-6.8.jar

    reportng包:reporting.jar,velocity-dep.jar
    ant包:ant-contrib.jar

三、新建一個testNG工程:(手動創建lib文件夾,需要把以上三個JAR包放在lib下面)

創建類和方法:
import org.testng.annotations.Test;
public class test {
@Test(groups="init")
public void f() {
System.out.println("This is test f" );
}
@Test(groups="init")
public void g() {
System.out.println("This is test g" );
}
@Test(dependsOnGroups="init",groups="proccess")
public void h() {
System.out.println("This is test h " );
}
@Test(dependsOnGroups="init",groups="proccess")
public void i() {
System.out.println("This is test i" );
}

}
testng.xml 文件:
//















ant build.xml文件內容:
//

JENKINS引入SVN下載工程包,編譯運行:
SVN配置:

ANT配置:

報告輸出:
(JENKINS安裝TESTNG report 插件)
jenkins console執行報告輸出,基本上到這一步就成功了。

再看TESTNG插件生成的TESTNG報告:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM