接口自动化生成Allured报告

第一步需要新建Maven项目,编写代码实现自动化,在IDEA控制台输入 mvn clean test

第二步 在Pom.xml配置对应的Allured jar和配置对应的Allured配置,生成本地Allured

<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-testng</artifactId>
    <version>2.13.1</version>
    <scope>test</scope>
</dependency>
防止有乱码
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>  
<build>
    <plugins>
        <plugin>
            <!-- maven-surefire-plugin 配合testng.xml执行测试用例的maven插件 -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.1</version>
            <configuration>
                <!-- 测试失败后,是否忽略并继续测试 -->
                <testFailureIgnore>true</testFailureIgnore>
                <suiteXmlFiles>
                    <suiteXmlFile>testNg.xml</suiteXmlFile>
                </suiteXmlFiles>
                <systemProperties>
                    <property>
                        <!-- 配置 allure 结果存储路径 -->
                        <name>allure.results.directory</name>
                        <value>${project.build.directory}/allure-results</value>
                    </property>
                </systemProperties>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

第三步:在控制台执行  mvn io.qameta.allure:allure-maven:serve

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值