1. 程式人生 > >使用newman執行接口測試用例

使用newman執行接口測試用例

family erro html all image post soft db2 install

一、安裝Newman npm install -g newman 二、執行case newman run case生成的json文件 三、參數 npm install -g newman
  • -e <source>, --environment <source>
設置環境變量
  • -g <source>, --globals <source>
設置全局變量   -r cli   -r json 生成cli或json格式的報告 需要執行命令npm install -g newman-reporter-html來全局安裝支持Newman生成html報告的組件 然後,再次執行命令newman run Postman_API_test.postman_collection.json -d data.json -r html
一般常用以下命令 newman run 用例集json -e 環境變量json -g 全局變量json 四、示例 1、設置environment環境 -e 執行以下命令 newman run test.postman_collection.json -e test.postman_environment.json >d://error.log 技術分享圖片 執行結果 技術分享圖片 技術分享圖片 由於接口依賴登錄,未設置登錄cookie導致請求失敗,故需要將cookie設置為全局變量 2、設置全局變量 -g 執行以下命令 newman run test.postman_collection.json -e test.postman_environment.json -g C:\Users\test.postman_global.json >d://error1.log 技術分享圖片 技術分享圖片 技術分享圖片

使用newman執行接口測試用例