
TestNG自动化实践
文章平均质量分 57
TestNG持续集成自动化测试
LetsStudy
The growth of age will not be a hindrance to study.
展开
-
1.6 testng参数传递的几种方式
1、通过jenkins传递或者<systemPropertyVariables>传递,jenkins传递的值也是会被<systemPropertyVariables> 标签获取,在代码中可以通过System.getProperty()方法获取 https://blog.csdn.net/LetsStudy/article/details/114189463 2、通过Parameters注解及xml配置传参 <classes> <cl原创 2021-03-04 18:00:42 · 1189 阅读 · 2 评论 -
1.5 jenkins与pom间的参数传递
一、先在pom的<properties>标签内添加env参数,在@Test方法下添加 System.out.println(System.getProperty("env")); <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>15</maven.compil原创 2021-02-27 21:26:01 · 1047 阅读 · 0 评论 -
1.4 testNG与Jenkins集成
前提条件 ※已提交配置好gitlab ※已提前配置好Jenkins 1、在构建执行shell中配置mvn命令 2、构建后,报错mvn 命令Command not found 3、linux中配置maven tar -zxvf apache-maven-3.6.3-bin.tar.gz 配置环境变量 export PATH=$PATH:/download/apache-maven-3.6.3/bin 4、配置完后,立即构建,mvn依旧报错Command not found 5、j..原创 2021-02-27 00:23:07 · 621 阅读 · 0 评论 -
1.3 命令行运行testng.xml第二种方式
环境设置等,全基于上一篇博客 用另一种方式去执行xml 1、suite.xml和testng.xml都在根目录,注释掉<suiteXmlFile>,执行mvn clean test -Dsurefire.suiteXmlFiles 结果:报错,但是mvn clean test -DsuiteXmlFile这种方式确实可以执行的 2、suite.xml和testng.xml都在根目录,注释掉<suiteXmlFile>,执行mvn clean test -Dsurefire..原创 2021-02-26 16:43:54 · 904 阅读 · 0 评论 -
1.2 命令行执行testng.xml第一种方式
基于上一篇的环境 maven:3.6.3 jdk:15 surefire:3.0.0-M5 1、testng.xml位于根目录,suiteXmlFile中没有配置路径,直接命令行执行mvn test <suiteXmlFiles> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> 结果:控制台报错,经过分析,应该是由于.原创 2021-02-26 16:25:07 · 1226 阅读 · 0 评论 -
1、TestNG配置与执行
1、JDK、Maven等环境变量提前配置好 2、IDEA新建Maven项目 3、引入TestNG包,在把默认的测试类中的@Test及断言换成TestNG包,使用Create TestNG XML创建testng.xml 5、在maven-surefire-plugin下添加配置 <plugin> <artifactId>maven-surefire-plugin</artifactId> <versio原创 2021-02-25 19:00:46 · 541 阅读 · 1 评论