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 2023-09-05 17:57  yanmay  阅读(74)  评论(0编辑  收藏  举报

导航