您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 > TestNG
TestNG+Jenkins持續(xù)集成
作者:stone_xiao 發(fā)布時間:[ 2016/11/10 11:18:01 ] 推薦標(biāo)簽:單元測試 TestNG

  一、環(huán)境搭建
  安裝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工程:(手動創(chuàng)建lib文件夾,需要把以上三個JAR包放在lib下面)
  創(chuàng)建類和方法:
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文件內(nèi)容:
  //
  JENKINS引入SVN下載工程包,編譯運行:
  SVN配置:

  ANT配置:

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

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

軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd