java8

java配置allure2

2020-06-17  本文已影响0人  info_gu
  1. java项目pom文件配置
    maven默认JDK是1.5 设置后支持1.8
 <properties>
        <aspectj.version>1.8.10</aspectj.version>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
<dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit5</artifactId>
            <version>2.13.3</version>
            <scope>test</scope>
        </dependency>
<!--可能需要,楼主是报错添加该dependency-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.7.2</version>
        </dependency>

build配置

<build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</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>RELEASE</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>
                </configuration>
            </plugin>
        </plugins>
    </build>

2.maven命令执行 :mvn test 生成allure-results文件夹


image.png

3.下载allure工具
地址:https://repo1.maven.org/maven2/io/qameta/allure/allure-commandline/2.13.3/

image.png

4.配置环境变量


image.png image.png image.png

配置成功如图


image.png

5.项目中运行命令 : allure serve allure-results


image.png

如图所示表示成功


image.png
上一篇 下一篇

猜你喜欢

热点阅读