💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] 取最新版本的allure-testng ### maven pom文件里,添加如下内容 ``` <properties> <aspectj.version>1.8.10</aspectj.version> </properties> <dependencies> <dependency> <groupId>io.qameta.allure</groupId> <artifactId>allure-testng</artifactId> <version>LAST_VERSION</version> <scope>test</scope> </dependency> </dependencies> <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> <!-- 使allure-results在target文件夹下否则会生成在项目根目录下 --> <workingDirectory>target/</workingDirectory> </configuration> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> ``` 然后和平时一样运行mvn `mvn clean test` 使用如下命令,可以使Allure的结果生成在 target/allure-results文件夹下,然后生成html报告 并且自动使用web浏览器打开报告 `allure serve target/allure-results` ### Gradle 针对Gradle用户,提供allure-gradle插件,插件自动配置所依赖的jar包 build.gradle ``` buildscript { repositories { jcenter() } dependencies { classpath "io.qameta.allure:allure-gradle:2.3" } } plugins { id 'io.qameta.allure' } allure { version = '2.2.1' autoconfigure = true aspectjweaver = true allureJavaVersion = LATEST_VERSION } ``` 然后运行build文件 `./gradlew clean test` 使用如下命令,Allure报告会生成在build/allure-results文件夹下,生成html的报告并且自动在web浏览器上打开报告 `./gradlew allureServe build/allure-results`