1. 程式人生 > >Postman之命令測試

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

小夥伴們,你們覺得哪種更好看