Postman之命令行測試


前言

今天我們來學習一下Postman的命令行測試

1.先安裝node.js,https://nodejs.org/en/#home-downloadhead

2.安裝cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

3.安裝newman

cnpm install newman --global

4.檢查是否安裝成功 newman -v

使用newman命令行執行測試步驟

1.導出集合為json腳本

 

2.導出環境為json文件,如果你的集合中的接口使用了環境變量,還需要將環境變量導出來,如果沒有,就不用導了。

3.准備好參數文件(可選)

4.安裝reporter

cnpm install -g newman-reporter-html

5.執行命令 newman run 腳本 -d 參數文件 -e  環境文件 -n 循環次數 -r html --reporter-html-export 報告路徑 

在命令符輸入 

newman run cookie.json -e en.json -n 2 -r html --reporter-html-export  report.html

6.執行完,就在本地生成了一個report.html文件

 

在命令符輸入以下命令得到原生版的結果展示:

newman run cookie.json -e en.json -n 2

小伙伴們,你們覺得哪種更好看呢?


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM