一、postman下載安裝
二、postman 發(fā)送請求
1.發(fā)送get請求
2.發(fā)送post請求
https://www.cnblogs.com/shimh/p/6093229.html
三、postman全局變量配置
四、postman環(huán)境變量配置
五、批量執(zhí)行測試用例
六、postman+newman生成測試報告
1.下載node.js?官網(wǎng)
把node.exe的目錄加入到環(huán)境變量中。假設node.exe位于 C:\nodejs\node.exe。那么將E:\nodejs 加入到環(huán)境變量即可。打開cmd,輸入node,如果沒有報錯,而是顯示“>”,說明node安裝成功。
2.下載newman:
打開cmd輸入?
npm install -g newman
再安裝html??
npm?install?-g?newman-reporter-html
3.newman使用:
在postman里面export出接口,格式選擇V2.1
4、運行測試用例(參考https://www.cnblogs.com/echoqi/p/10264860.html)
執(zhí)行測試用例集:newman run 接口
例如:run /Users/jww/Downloads/華泰-API.postman_collection.json
指定生成報告的位置:r html --reporter-html-export 文件保存路徑
例如:newman run /Users/jww/Downloads/華泰-API.postman_collection.json -r html --reporter-html-export /Users/jww/Desktop/JWW
加上環(huán)境變量-e
例如:newman run /Users/jww/Downloads/華泰-測試1.postman_collection.json -e /Users/jww/Downloads/htxd2test.moguyun.com.postman_environment.json -r html --reporter-html-export /Users/jww/Desktop/JWW
設置全局變量?-g
例如:newman run test.postman_collection.json -e test.postman_environment.json -g C:\Users\test.postman_global.json >d://error1.log