1.坐标
<!--Allure报告依赖包-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
<!--Allure报告生成插件依赖包-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
2.插件内容
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<!--设置参数命令行-->
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemPropertyVariables>
<!--是否忽略html,解释见下图。与之后在reportNg报告上显示截图相关。当前已经使用allure了,这里可以直接去掉啦-->
<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
<!--测试失败后,是否忽略并继续测试-->
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-Dfile.encoding=UTF-8
</argLine>
<suiteXmlFiles>
<!--代表的是要执行的测试套件名称-->
<!-- <suiteXmlFile>src/test/resources/testNG.xml</suiteXmlFile>-->
<suiteXmlFile>testNG.xml</suiteXmlFile>
</suiteXmlFiles>
<systemProperties>
<property>
<!--配置 allure结果存储路径,$(project.build.directory)表示target目录-->
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
</configuration>
</plugin>
3.运行maven test执行测试用例。
详细步骤:Idea右侧窗口点开Maven Projects,找到对应模块点击test,执行完成后即可在模块目录下找到target/allure-results
4.查看allure报告
allure serve target/allure-results直接查看报告
终端中输入