jenkins 集成allure报告
前置条件: 已有jenkins,有已经配置好jdk环境、python环境,有job(里面有测试用例,可以生成allure报告)
1.安装插件
系统管理>插件管理>可选插件,安装Allure
注意安装 Python、Pyenv Pipeline插件
2.配置allure环境
系统管理>全局工具配置>Allure Commandline
3.在构建的job中使用allure report
构建时运行py脚本
python脚本执行可能会遇到很多错误,比如
python /tmp/jenkins13233123643516016151.py FATAL: command execution failed java.io.IOException: error=2, No such file or directory
这种是找不到python执行环境 ,参考了https://cloud.tencent.com/developer/article/1566505
方法1.在jenkins所在服务器/容器上安装pyton环境 apt-get update apt-get install python3
(后续要 apt-get install pip
pip install -r requirements.txt
在jenkins上面系统管理>系统配置>全局属性>环境变量,配置键值对 python:/usr/bin/python3
似乎还是不行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
方法2:在python镜像上构建jenkins(积重难返了属于是)
方法3:
在方法1的基础上,jenkins调用shell

构建后操作>添加构建后操作步骤>Allure Report
Results:Path用于指明报告路径,Properties可以设置一些报告解析的参数,可不填。
4.启动构建,产生allure报告
第一次比较慢,jenkins要安装allure commandline工具
后台allure报告位置
查看报告(为空是因为我构建的job里面没有测试用例)
参考 https://www.cnblogs.com/linuxchao/p/linuxchao-jenkins-allure.html