postman+NewMan+Jenkins

一、postman下載安裝

https://www.getpostman.com/

二、postman 發送請求

1.發送get請求

2.發送post請求

https://www.cnblogs.com/shimh/p/6093229.html

三、postman全局變量配置

四、postman環境變量配置

五、批量執行測試用例

六、postman+newman生成測試報告

1.下載node.js?官網

把node.exe的目錄加入到環境變量中。假設node.exe位于 C:\nodejs\node.exe。那么將E:\nodejs 加入到環境變量即可。打開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

執行測試用例集: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

加上環境變量-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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容