postman测试报告

Newman是Postman的命令行工具,用于在命令行中运行和测试Postman集合。它允许您以自动化的方式运行和监视API测试,并生成有关测试结果的报告。Newman插件可以帮助您在持续集成(CI)或其他自动化流程中集成和使用Newman。

newman工具需要node.js(需要先安装node.js)

 

安装node.js后再安装newman:

 npm install -g newman

 

安装newman插件:newman-reporter-htmlextra(生成测试报告)

 

npm install -g newman-reporter-htmlextra (管理员权限开启cmd)

 

1、需要导出用例集

2、环境文件导出

如果测试用例脚本中,包含环境变量使用。必须要导出环境文件

强烈建议,将环境变量,用例集文件 存放在同一目录

3、newman 生成测试报告

newman  run  测试集文件  -e  环境变量文件 -d 测试数据文件  -r htmlextra   --reporter -htmlextra-export   report.html

 

newman  run  测试集文件  -e  环境变量文件 -d 测试数据文件  -r html    --reporter -html-export   report.html

 

run  xx.json: 执行测试集文件

-e source: 环境变量文件

-d source:  测试数据文件(参数化的文件)

-r  htmlextra: 生成测试报告的类型

--reporter -htmlextra-export   source: 存放报告的路径

 

 newman run  .\参数化.postman_collection.json  -r html

 

 newman run .\参数化.postman_collection.json -r htmlextra  --reporter-htmlextra-export ./test.html

 

 newman run .\参数化.postman_collection.json -r html  --reporter-html-export ./test.html

 

 

posted on   yanmay  阅读(121)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示