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。

相关推荐
xxxxxxllllllshi1 天前
Java中Elasticsearch完全指南:从零基础到实战应用
java·开发语言·elasticsearch·面试·职场和发展·jenkins
黑马金牌编程2 天前
Jenkins的Linux与window部署方式
linux·运维·windows·jenkins·持续集成·cicd
weixin_307779132 天前
在Linux服务器上使用Jenkins和Poetry实现Python项目自动化
linux·开发语言·python·自动化·jenkins
蓝色空白的博客2 天前
自动化测试脚本-->集成测试部署思路整理(1)
python·集成测试
念念不忘 必有回响2 天前
前端自动化部署全流程(Jenkins + Nginx)
前端·自动化·jenkins
不 再 熬 夜2 天前
Docker搭建Jenkins
docker·jenkins
胜天半月子2 天前
接口测试 | Postman的高级用法的测试使用
测试工具·接口测试·postman
tingting01193 天前
jenkins在使用中遇到的问题
运维·jenkins
一张假钞3 天前
Windows下Jenkins服务未自动重启问题解决
jenkins
Narutolxy3 天前
从混合部署到高可用:在内网环境下搭建 GitLab-Jenkins-OpenResty的完整实战复盘20251014
gitlab·jenkins·openresty