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。

相关推荐
悟能不能悟5 小时前
怎么使用postman批量的给api做测试
测试工具·lua·postman
oMcLin2 天前
如何在Rocky Linux 8.5上部署并优化Jenkins流水线,支持跨平台CI/CD自动化与容器化构建?
linux·ci/cd·jenkins
Wang201220132 天前
CP(Chip Probing) 探针材质的选择和针头类型的选择
集成测试
无心水2 天前
【分布式利器:腾讯TSF】7、TSF高级部署策略全解析:蓝绿/灰度发布落地+Jenkins CI/CD集成(Java微服务实战)
java·人工智能·分布式·ci/cd·微服务·jenkins·腾讯tsf
时时刻刻看着自己的心2 天前
socket hang up postman报错
测试工具·postman
程序员小远2 天前
Postman接口测试详解
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
记得开心一点嘛2 天前
Elasticsearch
运维·jenkins
QH139292318802 天前
Anritsu MT8821C MT8000A无线电通信分析仪
网络·科技·集成测试·模块测试
oMcLin3 天前
如何在 Ubuntu 22.04 上部署并优化 Jenkins 2.x 流水线,提升持续集成与自动化测试的效率?
ubuntu·ci/cd·jenkins