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。

相关推荐
糖果店的幽灵12 小时前
软件测试接口测试从入门到精通:Postman入门到精通
软件测试·测试工具·接口测试·postman·api测试
墨香幽梦客1 天前
API集成最佳实践:Postman+MuleSoft实现ERP与OA系统无缝对接
测试工具·postman
未若君雅裁1 天前
日志采集与ELK:从本地日志到集中检索分析
运维·elk·jenkins
学代码的真由酱1 天前
【自用】接口测试
接口测试·postman·测试·cookie·token鉴权
Dontla1 天前
CI/CD前世今生(持续集成、持续交付、持续部署、Jenkins、Github Actions)
ci/cd·github·jenkins
Java 码思客1 天前
【ElasticSearch从入门到架构师】第7章-聚合查询——实现数据统计与分析
大数据·elasticsearch·jenkins
逻极2 天前
Jenkins 从入门到精通:CI/CD自动化流水线实战
ci/cd·自动化·jenkins·devops
炸炸鱼.2 天前
Git+Jenkins实战(一):从零搭建自动化发布与回滚系统(附完整代码)
git·jenkins
无人生还别怕2 天前
搭建jenkins服务并接入openldap认证
运维·jenkins
FirstFrost --sy3 天前
基于高并发服务器的web小游戏测试
服务器·前端·javascript·c++·python·集成测试