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。

相关推荐
ji_shuke11 小时前
从零深入:基于 Playwright + Pytest + Allure 的企业级 Web 端到端自动化测试框架实战
前端·自动化测试·docker·jenkins·pytest·allure·playwright
降临-max15 小时前
Postman----接口自动化
软件测试·功能测试·自动化·postman
测试秃头怪16 小时前
postman接口测试详解
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
上海安当技术16 小时前
老系统零改造接入:旁路代理统一认证实战
java·servlet·架构·kubernetes·jenkins
Mr. zhihao17 小时前
Jenkins 从节点连不上主节点?一次网络排查全记录 + 机器间通信“拦截层“全景讲解
网络·servlet·jenkins
QH139292318801 天前
Keysight N9020B MXA 矢量信号 / 频谱分析仪
stm32·单片机·嵌入式硬件·集成测试·嵌入式实时数据库
减瓦2 天前
告别Postman——用VSCode优雅地发起Http请求
vscode·http·postman
砍材农夫2 天前
运维|devops|jenkins构建分支选择及执行日志展示
运维·jenkins·devops
阿标在干嘛2 天前
政策快报平台日志系统的3次演进:从文件到ELK到告警
运维·elk·jenkins
worilb3 天前
Spring Cloud 学习与实践(16):Elasticsearch 商品搜索、中文分词与索引一致性
运维·jenkins