Allure 2 安装与配置完全指南

Allure 2 安装与配置完全指南

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

项目基础介绍与主要编程语言

Allure Report 是一个灵活且轻量级的多语言测试报告工具,旨在为软件开发过程中的测试提供清晰的图形化报告。它支持多种测试框架,并跨越多个编程语言,帮助团队成员更高效地理解日常测试的成果。该项目主要采用 Java 作为核心编程语言,并利用一系列现代技术栈构建。

关键技术和框架

  • 多语言支持: 支持TestNG、JUnit等多种测试库。
  • 报告引擎: 提供丰富的数据可视化,包括统计、趋势分析等。
  • DevOps集成: 与CI/CD系统(如Jenkins)无缝整合,方便自动化测试报告生成。
  • 可扩展性: 通过插件机制支持自定义扩展,例如与JIRA等工具的集成。
  • 跨平台: 支持Windows、macOS和Linux操作系统。
  • 基于Maven和Gradle的构建: 方便项目集成与管理。

安装与配置步骤

准备工作

  1. 确保环境: 确保你的机器上已安装Java Development Kit (JDK),版本建议1.8或更高。
  2. Git客户端: 如果你打算从GitHub克隆项目,需安装Git。
  3. IDE选择: 可选,推荐使用IntelliJ IDEA或Eclipse等支持Maven的IDE以简化开发。

安装步骤

全局安装Allure命令行工具

对于大多数用户,首先安装Allure命令行工具将是开始的一步:

  1. Mac/Linux使用Homebrew安装:

    brew install allure
    
  2. Windows用户使用Scoop:

    • 安装Scoop(如果尚未安装):
      iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
      
    • 然后安装Allure:
      scoop install allure
      
项目集成与报告生成
  1. 添加依赖:

    • 对于Maven项目,在pom.xml中添加Allure与对应的测试框架依赖(以TestNG为例):
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
        <!-- 或者使用最新版本 -->
        <!-- 注意: 实际操作时应查询最新的TestNG版本 -->
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-testng</artifactId>
        <version>(查看仓库获取最新版本)</version>
        <scope>test</scope>
    </dependency>
    
  2. 配置Maven Surefire Plugin: 在pom.xml<build>标签内,添加Surefire插件配置,以便在测试运行时收集Allure数据:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>(适用的版本)</version>
                <configuration>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>io.qameta.allure.testng.AllureTestNgListener</value>
                        </property>
                    </properties>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
  3. 运行测试并生成报告

    在终端中,导航到项目根目录并运行测试,Allure数据会被临时保存:

    mvn clean test
    
  4. 生成和查看报告

    在测试成功执行后,生成Allure报告:

    allure serve target/allure-results
    

    此命令将启动一个本地服务器,你可以通过浏览器访问报告(通常是http://localhost:8080)。

至此,你就完成了Allure的基本安装与配置,可以根据自己的测试结果生成具有视觉吸引力的测试报告了。记得替换版本号为实际检查的最新版本以保持最佳兼容性和功能。

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
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

咎锨勃

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

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

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

打赏作者

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

抵扣说明:

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

余额充值