1987WEB视界-分享互联网热门产品和行业

您现在的位置是:首页 > WEB开发 > 正文

WEB开发

Jenkins配置-学习笔记

1987web2023-10-06WEB开发155
修改默认工作目录Homedirection

修改默认工作目录Home direction

进入 Jenkins 安装目录,打开 jenkins.xml 文件,找到

修改value为 D:\Jenkins

重启Jenkins

根据提示找到这个文件,复制密码后登录

查看是否修改成功

更新源

将原来的https://updates.jenkins.io/update-center.json为清华大学源

https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json

打开updates下的default.json文件

将connectionCheckUrl中的

http://google.com/改为http://baidu.com/

再将https://updates.jenkins.io/download

批量替换为

https://mirrors.tuna.tsinghua.edu.cn/jenkins

安装allure插件

可以使用默认的工作空间,也可以自定义配置工作空间

指定构建执行的机器

先在系统配置中,进入节点管理

新建一个节点

勾选限制项目的运行节点,找到已添加的节点

配置自定义变量

可以在 构建环境 或者 构建 - Inject environment variables to the build process -

Properties Content 中配置自定义变量

D:

cd %testcase_path%\test\fund

pytest -s -q test_fund.py::TestConfig --alluredir %WORKSPACE%\allure-results

exit 0

注意:Windows中使用变量格式为 %变量名%,Linux中为 ${变量名}

docker中运行

如果在docker中,可以在docker中先添加一个启动的shell脚本,然后直接通过docker运行这个shell脚本来启动

生成Allure测试报告

在构建后操作中,选择Allure Report

Results Path 和 Report Path使用默认的即可,因此在构建的脚本中也命名为allure-results

构建完成以后,就能在目录下看到测试报告的文件了

点击按钮即可查看Allure测试报告

如果打开后无数据,显示404。则需要检查报告文件路径配置是否正确