魅力JUnit Maven-DisplayName未显示在报告中

时间:2020-10-03 13:37:10

标签: java maven junit4 allure

我正在使用Java,JUnit4,Maven,Allure。并且无法使@DisplayName显示在我的报告中。

这是pom.xml

<?xml version="1.0" encoding="UTF-8"?>

4.0.0

<groupId>JavaAppium</groupId>
<artifactId>JavaAppium</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <aspectj.version>1.8.10</aspectj.version>
    <allure.version>2.13.6</allure.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <systemPropertyVariables>
                    <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                </systemPropertyVariables>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>io.qameta.allure.junit4.AllureJunit4</value>
                    </property>
                </properties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>6.1.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-junit4</artifactId>
        <version>${allure.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

以下是Github Gist上相同pom.xml的链接:https://gist.github.com/KotovVitaliy/2c82163782250cbd71e89eb600b16b5c

我的测试开始于:

@Test
@DisplayName("Compare something with expected one")
@Description("This is ololo description")
public void testCompareSomething()

我已经通过brew安装了Allure,并像这样使用它:

allure serve ./target/allure-report/

但不显示@DisplayName或@Description,仅显示测试testCompareSomething的原始名称

我在做什么错了?

0 个答案:

没有答案