jenkins配置allure报告
时间: 2025-03-15 10:17:58 浏览: 84
### 如何在 Jenkins 中生成和集成 Allure 测试报告
要在 Jenkins 中成功生成并集成 Allure 测试报告,需要完成以下几个方面的配置:
#### 1. **安装必要的插件**
为了支持 Allure 报告的生成与展示,需先安装对应的 Jenkins 插件。通过访问 Jenkins 的管理页面 `【Manage Jenkins】 -> 【Manage Plugins】` 进入插件管理界面,在可用插件列表中搜索 “Allure”,找到名为 “Allure Jenkins Plugin”的插件进行安装[^3]。
#### 2. **配置 Allure Commandline 工具**
除了插件外,还需要正确设置 Allure Commandline 工具以便执行命令行操作来生成 HTML 报告。具体步骤如下:
- 转至 `【Manage Jenkins】 -> 【Global Tool Configuration】` 页面;
- 向下滑动直到发现 “Allure Commandline” 配置区域;
- 添加一个新的 Allure 实例,并指定其版本号以及自动安装路径(如果未手动下载)。完成后记得保存更改。
#### 3. **项目级别的构建后处理**
对于每一个希望启用 Allure 报告功能的具体项目而言,则要调整它的构建流程定义部分。主要涉及两个参数设定:
- 在构建后的动作里新增一项叫做 “Generate Allure Report” 或者类似的选项;
- 设置好原始数据存储位置 (`Path to binary files`) 和最终HTML输出目标地址 (`Report path`) 。这些路径通常相对于工作区根目录给出。
#### 4. **确保 Java 环境已准备好**
由于 Both Jenkins and Allure rely heavily on the Java runtime environment, it is essential that a proper JDK/JRE installation exists beforehand within your system setup where Jenkins operates from.[^4]
#### 5. **验证本地 Allure 文件是否存在**
Before attempting any generation steps inside Jenkins itself, confirm whether actual result artifacts (like JSON/XML logs etc.) produced by test frameworks compatible with Allure exist at expected locations specified earlier during job configuration phase.[^5]
一旦以上准备工作全部落实到位,每次触发该流水线作业时都会自动生成一份最新的可视化测试分析图表供查阅。
```bash
# Example command used outside of CI/CD context but still relevant here as reference.
allure serve /path/to/test-results/
```
阅读全文
相关推荐


















