1、安裝newman,npm安裝可查看1.2
npm install newman --global
2、安裝完成可以用命令查看版本信息
newman --version
3、下載需要運(yùn)行的postman_collection.json,和postman_environment.json,postman_globals.json
4、
newman run 用戶集合腳本文件.json --environment 環(huán)境變量文件.json --iteration-data 外部csv數(shù)據(jù)文件.csv --globals 全局變量的json文件 --timeout-request 500(超時(shí)時(shí)間) --reporters html --reporter-html-export 指定報(bào)告文件名.html
case1
如果執(zhí)行時(shí)報(bào)錯(cuò),需要安裝newman-reporter-html,執(zhí)行:nmp install -g newman-reporter-html

image.png
再次執(zhí)行

image.png
newman run D:\postman\巴士集團(tuán).postman_collection.json --environment D:\postman\正式環(huán)境.postman_environment.json --reporters html --reporter-html-export htmlOutput.html

執(zhí)行報(bào)告