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。

相关推荐
heimeiyingwang13 小时前
【CI/CD·Jenkins篇】环境搭建:从零部署 Jenkins 主从架构
ci/cd·jenkins
heimeiyingwang15 小时前
【CI/CD·Jenkins篇】Pipeline 基础:Declarative 与 Scripted 语法详解
ci/cd·pipeline·jenkins
昨夜星河入梦来2 天前
postman接口测试报错503的解决方法
开发语言·postman
遨游DATA2 天前
Jenkins 修改 config.xml 后页面仍是旧配置:让 live job 配置真正生效
ci/cd·jenkins·devops·故障排查·config.xml
Dobby_052 天前
【CICD】Jenkins Pipeline 快速学习入门
运维·学习·jenkins
上海安当技术2 天前
统一身份认证平台怎么落地?11 个异构业务系统接入 ASP 的完整实施路径
数据库·servlet·架构·kubernetes·jenkins
冷凝娇3 天前
【Postman】2026总结
测试工具·postman
回眸不遇4 天前
Elasticsearch嵌套类型nested使用指南
大数据·elasticsearch·jenkins
QH139292318805 天前
Keysight N9917B N9918B手持式综合微波分析仪
网络·科技·嵌入式硬件·集成测试·信息与通信
回眸不遇5 天前
类型的区别和应用场景 nested 每个对象独立存储为隐藏的子文档 适合存储数组 查询的时候有特定的语法 nested查询 且字段要 ...
运维·jenkins