本地执行方式:
1.下载地址
2.执行机器添加环境变量
如mac:vi /etc/profile
export ALLURE_HOME=/Users/qiaojiafei/Documents/work/soft/allure-2.10.0 PATH=“.$PATH:$JAVA_HOME/bin:/usr/local/bin:/usr/local/opt/bison/bin:$MYSQL_HOME:$M2_HOME/bin:$ANT_HOME/bin:$ALLURE_HOME/bin:”
3.配置环境变量后,生效 source /etc/profile
4.查看配置是否成功
5.pom文件添加依赖
<dependency> <!--Allure的Jar包 --> <groupId>io.qameta.allure</groupId> <artifactId>allure-testng</artifactId> <version>2.10.0</version> <scope>test</scope> </dependency> <dependency> <!--Allure实现TestNG报告解析优化所需Jar包 --> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.3</version> </dependency>
6.pom文件添加插件
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.20</version> <configuration> <argLine> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" </argLine> </configuration> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.3</version> </dependency>
7.可选,进入case中,在test方法上面增加注解
@Epic("正向epic")//测试集 @Story("正向story")//测试case @Step("获取城市编码")//测试步骤 @Severity(SeverityLevel.CRITICAL)//设置case的优先级
8.执行mvn test,会发现在工程目录下生成文件夹allure-results;
9.执行 allure serve命令,自动生成报告并打开
jenkins执行方式
待写
原文地址:https://www.cnblogs.com/qiaoyeye/p/10749247.html
时间: 2024-11-08 07:00:20