mqzlp 发表于 2018-1-6 22:37:59

TESTNG+JENKINS持续集成

  一、环境搭建

[*]  安装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>  @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配置:
https://images2015.cnblogs.com/blog/816853/201611/816853-20161104112845361-224894314.png
  ANT配置:
https://images2015.cnblogs.com/blog/816853/201611/816853-20161104112913033-1089837005.png
  报告输出:
  (JENKINS安装TESTNG report 插件)
  jenkins console执行报告输出,基本上到这一步就成功了。
https://images2015.cnblogs.com/blog/816853/201611/816853-20161104113451455-1967450719.png
  再看TESTNG插件生成的TESTNG报告:
https://images2015.cnblogs.com/blog/816853/201611/816853-20161104113218971-618336380.png
页: [1]
查看完整版本: TESTNG+JENKINS持续集成