美观的测试报告-allure(诱惑力)

pom需要的依赖:

<dependency>
    <groupId>ru.yandex.qatools.allure</groupId>
    <artifactId>allure-testng-adaptor</artifactId>
    <version>1.3.6</version>
    <exclusions>
        <exclusion>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-testng</artifactId>
    <version>2.9.0</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>

<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-java-commons</artifactId>
    <version>RELEASE</version>
</dependency>


<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <!--该插件是解决命令下执行mvn test指定testng xxx.xml 文件 的配置-->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <!--为了解决在jenkins maven执行test 报告乱码问题,编码格式设置为UTF-8-->
                <argLine>-Dfile.encoding=UTF-8</argLine>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <!--动态指定执行的xml文件。${project.basedir}项目目录,${xmlFileName}maven文件-->
                <suiteXmlFiles>
                    <suiteXmlFile>${project.basedir}/target/classes/${xmlFileName}</suiteXmlFile>
                </suiteXmlFiles>
                <!--生成allure-result的目录-->
                <systemProperties>
                    <property>
                        <name>allure.results.directory</name>
                        <value>${project.build.directory}/allure-results</value>
                    </property>
                    <property>
                        <name>allure.link.issue.pattern</name>
                        <value>https://example.org/issue/{}</value>
                    </property>
                </systemProperties>
                <!-- testng配置参数 -->
                <systemPropertyVariables>
                    <testEnvironment>${env}</testEnvironment>
                    <testEnvironment>${driver}</testEnvironment>
                    <testEnvironment>${baseUrl}</testEnvironment>
                </systemPropertyVariables>
                <!--<testFailureIgnore>true</testFailureIgnore>-->
                <useSystemClassLoader>false</useSystemClassLoader>

                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter</value>
                    </property>
                </properties>

               <!-- <workingDirectory>target/</workingDirectory>-->
                <forkMode>always</forkMode>
            </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>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>

</build>

1.打包测试

clean test

2.生成报告

allure serve allure-results

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值