【发布时间】:2022-01-23 23:35:40
【问题描述】:
我尝试查看由 maven-plugin 和 JUnit 5 生成的 Allure 报告,但 html 页面为空
我通过mvn clean test 构建我的报告,然后我使用mvn allure:serve 并且它构建没有错误。但打开的诱惑站点是空的或包含 NaN 值。
使用allure serve target/surefire-reports 启动诱惑网站会生成正确的网页
构建日志不包含任何错误,并表示一切正常,生成后我在/allure-results 上发现了许多带有报告的 json 文件,其中包含项目测试和容器的信息:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< org.example:TestProject >-----------------------
[INFO] Building TestProject 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- allure-maven:2.10.0:serve (default-cli) @ TestProject ---
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] Allure installation directory C:\Users\Я\IdeaProjects\TestProject/.allure
[INFO] Try to finding out allure 2.8.1
[INFO] Generate Allure report (serve) with version 2.8.1
[INFO] Generate Allure report to C:\Users\Я\IdeaProjects\TestProject\target\site/allure-maven-plugin
[INFO] Found results directory C:\Users\Я\IdeaProjects\TestProject\allure-results
[INFO] Can't find information about categories.
[INFO] Generate report to C:\Users\Я\IdeaProjects\TestProject\target\site\allure-maven-plugin
Generating report to temp directory...
Report successfully generated to C:\Users\4483~1\AppData\Local\Temp\8774552783003673881\allure-report
Starting web server...
2021-12-22 22:16:25.525:INFO::main: Logging initialized @1032ms to org.eclipse.jetty.util.log.StdErrLog
Server started at <http://192.168.56.1:64312/>. Press <Ctrl+C> to exit
我的 pom.xml:
<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>org.example</groupId>
<artifactId>TestProject</artifactId>
<version>1.0-SNAPSHOT</version>
<name>TestProject</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.17.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemProperties>
<property>
<name>junit.jupiter.extensions.autodetection.enabled</name>
<value>true</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<!-- <reportVersion>2.4.1</reportVersion>-->
<buildDirectory>${project.basedir}</buildDirectory>
</configuration>
</plugin>
</plugins>
</build>
【问题讨论】: