Postman + Jenkins + Report 集成测试

  1. 安装nodejs

下载nodejs包

$ cd /usr/bin

$ sudo ln -s /local/mnt/workspace/tools/node-v23.5.0-linux-x64/bin/npm npm

$ sudo ln -s /local/mnt/workspace/tools/node-v23.5.0-linux-x64/bin/node node

  1. 安装newman

通过npm安装newman

$ npm install -g newman --registry https://registry.npmmirror.com/

$ npm install -g newman-reporter-html --registry https://registry.npmmirror.com/

$ npm install -g newman-reporter-htmlextra --registry https://registry.npmmirror.com/

$ cd /usr/bin

$ sudo ln -s /local/mnt/workspace/tools/node-v23.5.0-linux-x64/bin/newman newman

Note: 安装newman-reporter-htmlextra生成更加好看的报告。

  1. 启动Jenkins

启动Jenkins后如果测试报告的css样式丢失,则需要在启动Jenkins是增加如下property。

java -Dhudson.model.DirectoryBrowserSupport.CSP= -jar jenkins.war --httpPort=8172

  1. 怎样执行postman collection

在Jenkins job configuration页面,添加shell script

newman run <collection_file> -e <environment_file> -r cli,htmlextra --reporter-htmlextra-export report/test_report.html

  1. 在Jenkins Job中展示html报告

在Jenkins job configuration页面,添加Post-build Actions -> Publish HTML reports。

相关推荐
睡不醒的猪儿3 小时前
k8s部署自动化工具jenkins
云原生·kubernetes·自动化·jenkins
计算衎9 小时前
Jenkins上实现CI集成软件信息Teams群通知案例实现。
python·jenkins·1024程序员节·microsoft azure·teams消息群通知·微软 graph api
dehuisun18 小时前
centos7部署jenkins
jenkins
xxxxxxllllllshi21 小时前
【Elasticsearch查询DSL API完全指南:从入门到精通】
java·大数据·elasticsearch·搜索引擎·面试·全文检索·jenkins
水冗水孚1 天前
Jenkins系统管理页面错误:反向代理设置有误
jenkins
catoop1 天前
Jenkins Pipeline 中使用 GitLab Webhook 触发任务执行
jenkins
Gss7771 天前
Jenkins流水线项目发布
运维·jenkins
爱学习的爬虫1 天前
Python实现Jenkins实现自动化执行Job
python·自动化·jenkins
dehuisun2 天前
jenkins流水线部署springboot项目
运维·jenkins
神秘人X7072 天前
Jenkins 持续集成与部署指南
运维·ci/cd·jenkins