无法使用testng和maven生成魅力报告
Unable to generate allure report using testng and maven
TestNG 版本
7.1.0
预期行为
mvn test 命令应该正常执行测试,知道在我更新 testNG 和其他一些依赖项之前相同的 POM 工作正常,我也在使用 testNG 和 maven 的 allure,现在如果我禁用 allure-TestNG测试将被执行,但 allure 不会生成任何报告
实际行为
我遇到了这个错误
个别测试结果请参考C:\Users\warrior\Desktop\MobileAutomationTest\target\surefire-reports。
请参考转储文件(如果存在)[date].dump、[date]-jvmRun[N].dump 和 [date].dumpstream。
分叉 processorg/testng/IInvokedMethodListener2 中有错误
org.apache.maven.surefire.booter.SurefireBooterForkException: 分叉时出错 processorg/testng/IInvokedMethodL
监听器2
该问题是否可以在跑步者身上重现?
- [x] Maven
- [x] IntelliJ
测试用例样本
POM 文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MobileAutomationTest</groupId>
<artifactId>SafeApp</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<jre.level>1.8</jre.level>
<jdk.level>1.8</jdk.level>
<aspectj.version>1.9.5</aspectj.version>
</properties>
<build>
<plugins>
<!-- Compiler plug-in -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${jdk.level}</source>
<target>${jdk.level}</target>
</configuration>
</plugin>
<!-- Added Surefire Plugin configuration to execute tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<suiteXmlFiles>
<suiteXmlFile>src/test/java/TestNG.xml/</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
</dependency>
<!-- <!– https://mvnrepository.com/artifact/io.qameta.allure/allure-testng –>-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.13.0</version>
</dependency>
<!--https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<!-- log4j2 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.29</version>
</dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportDirectory>${basedir}\target\allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
这里的问题是与 TestNG 7.1.0
不兼容的 Allure 报告。
TestNG 7.1.0
删除了侦听器 IInvokedMethodListener2
接口。
这需要在 Allure 报告中解决。
我还在为此记录的 github 问题中添加了更多信息:https://github.com/cbeust/testng/issues/2246
我也遇到同样的错误,通过将 test-ng 版本降级到 7.0.0 解决了这个问题
在终端中的项目文件夹路径上尝试此命令
mvn io.qameta.allure:allure-maven:serve
TestNG 版本
7.1.0
预期行为
mvn test 命令应该正常执行测试,知道在我更新 testNG 和其他一些依赖项之前相同的 POM 工作正常,我也在使用 testNG 和 maven 的 allure,现在如果我禁用 allure-TestNG测试将被执行,但 allure 不会生成任何报告
实际行为
我遇到了这个错误 个别测试结果请参考C:\Users\warrior\Desktop\MobileAutomationTest\target\surefire-reports。 请参考转储文件(如果存在)[date].dump、[date]-jvmRun[N].dump 和 [date].dumpstream。 分叉 processorg/testng/IInvokedMethodListener2 中有错误 org.apache.maven.surefire.booter.SurefireBooterForkException: 分叉时出错 processorg/testng/IInvokedMethodL 监听器2
该问题是否可以在跑步者身上重现?
- [x] Maven
- [x] IntelliJ
测试用例样本
POM 文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MobileAutomationTest</groupId>
<artifactId>SafeApp</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<jre.level>1.8</jre.level>
<jdk.level>1.8</jdk.level>
<aspectj.version>1.9.5</aspectj.version>
</properties>
<build>
<plugins>
<!-- Compiler plug-in -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${jdk.level}</source>
<target>${jdk.level}</target>
</configuration>
</plugin>
<!-- Added Surefire Plugin configuration to execute tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<suiteXmlFiles>
<suiteXmlFile>src/test/java/TestNG.xml/</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
</dependency>
<!-- <!– https://mvnrepository.com/artifact/io.qameta.allure/allure-testng –>-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.13.0</version>
</dependency>
<!--https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<!-- log4j2 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.29</version>
</dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportDirectory>${basedir}\target\allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
这里的问题是与 TestNG 7.1.0
不兼容的 Allure 报告。
TestNG 7.1.0
删除了侦听器 IInvokedMethodListener2
接口。
这需要在 Allure 报告中解决。
我还在为此记录的 github 问题中添加了更多信息:https://github.com/cbeust/testng/issues/2246
我也遇到同样的错误,通过将 test-ng 版本降级到 7.0.0 解决了这个问题
在终端中的项目文件夹路径上尝试此命令
mvn io.qameta.allure:allure-maven:serve