使用mvn allure:report生成魅力报告

时间:2020-10-30 15:47:01

标签: java maven testng allure

我正在尝试使用mvn allure:report命令构建魅力报告,但是之后我的报告中出现404 Not found错误。

下面是我的pom.xml文件:

<?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>framework.testowy</groupId>
<artifactId>framework-testowy</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <!-- Dependency versions -->
    <selenium.version>3.141.59</selenium.version>
    <testng.version>7.3.0</testng.version>
    <drivermanager.version>3.8.1</drivermanager.version>
    <metalloid.version>2.2.0</metalloid.version>
    <allure.version>2.13.6</allure.version>
    <!-- Configurable variables -->
    <threads>2</threads>
    <browser>firefox</browser>
    <!-- Selenium Grid variables -->
    <remote>false</remote>
    <seleniumGridURL>http://127.0.0.1:4444/wd/hub</seleniumGridURL>
    <platform></platform>
    <browserVersion></browserVersion>
    <!-- Allure -->
    <aspectj.version>1.8.10</aspectj.version>
    <allure.directory>target/allure-results</allure.directory>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <reportVersion>2.4.1</reportVersion>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <parallel>methods</parallel>
                <threadCount>${threads}</threadCount>
                <systemPropertyVariables>
                    <browser>${browser}</browser>
                    <remoteDriver>${remote}</remoteDriver>
                    <gridURL>${seleniumGridURL}</gridURL>
                    <desiredPlatform>${platform}</desiredPlatform>
                    <desiredBrowserVersion>${browserVersion}</desiredBrowserVersion>
                    <allure.results.directory>${allure.directory}</allure.results.directory>
                </systemPropertyVariables>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
    </dependency>
    <!-- https://github.com/bonigarcia/webdrivermanager -->
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>${drivermanager.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.github.metalloid-project/page-factory -->
    <dependency>
        <groupId>com.github.metalloid-project</groupId>
        <artifactId>metalloid-page-factory</artifactId>
        <version>${metalloid.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-testng</artifactId>
        <version>${allure.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>
</project>

mvn test命令在项目的根文件夹/目标中生成allure-results文件夹

之后,命令mvn allure:serve成功生成以下报告: enter image description here

然后,如果我执行mvn allure:report命令,则会在target / site / allure-maven-plugin下生成新文件夹,并在其中包含index.html,但它看起来像这样: enter image description here

有人知道如何解决此问题,原因是什么?预先谢谢你。

0 个答案:

没有答案