Allure2 项目常见问题解决方案

Allure2 项目常见问题解决方案

allure2 Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process allure2 项目地址: https://gitcode.com/gh_mirrors/al/allure2

1. 项目基础介绍和主要编程语言

Allure2 是一个灵活、轻量级的多语言测试报告工具,旨在为测试结果提供清晰的图形报告。它支持多种编程语言和测试框架,包括但不限于 Java、Python、JavaScript 等。Allure2 的主要编程语言是 Java,但它通过插件机制支持多种语言和框架的集成。

2. 新手使用 Allure2 时需要注意的 3 个问题及解决步骤

问题 1:如何正确配置 Allure2 的 Maven 依赖?

解决步骤:

  1. 在项目的 pom.xml 文件中添加 Allure2 的依赖:

    <properties>
        <aspectj.version>1.9.2</aspectj.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>LAST_VERSION</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
  2. 配置 Maven Surefire Plugin:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    

问题 2:如何生成 Allure2 报告?

解决步骤:

  1. 在项目根目录下运行测试:

    mvn clean test
    
  2. 生成 Allure2 报告:

    mvn allure:report
    
  3. 打开生成的报告:

    allure serve target/allure-results
    

问题 3:如何在 Jenkins 中集成 Allure2 报告?

解决步骤:

  1. 在 Jenkins 中安装 Allure Jenkins Plugin。

  2. 在 Jenkins 项目的配置中,找到“构建后操作”部分,添加“Allure Report”步骤。

  3. 配置 Allure Report 的路径为 target/allure-results

  4. 保存配置并运行 Jenkins 构建。

  5. 构建完成后,点击“Allure Report”链接查看生成的报告。

通过以上步骤,新手可以顺利配置和使用 Allure2 项目,并解决常见的问题。

allure2 Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process allure2 项目地址: https://gitcode.com/gh_mirrors/al/allure2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

邹稳潜Willard

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值