postman安装路径_Newman进行postman脚本自动化
歡迎關注公眾號 學習資料不會少
主要內容:newman 的使用? ? ? ?
Newman的講解
Newman是postman命令行集成工具,使用Newman可以在命令行中運行postman的腳本,方便與Jenkins等CI&CD工具集成使用。
Newman的安裝
postman是由nodejs開發的,命令行newman為node.js的第三庫,所以要安裝newman,首先要安裝node.js環境。
下載安裝node.js ? https://nodejs.org/en/
命令行驗證node版本
$ node -v
v12.13.0
安裝newman
https://www.npmjs.com/package/newman
在命令行中輸入
npm install newman -g
? ?安裝比較慢 設置下載地址
npm config set registry=https://registry.npm.taobao.org
如果腳本運行過程中出現問題 安裝 4.0.0 版本
npm install -g newman@4.0.0
Newman使用
基本使用
運行基本腳本
$ newman run examples/sample-collection.json
常用運行參數
● -h, --help
? ?查看版本信息
● -v, --version
? ?顯示當前版本
運行時參數
newman run [options] ?
●?-e , --environment
環境變量,在postman中定義的局部環境變量的值導出的文件路徑。
●?-g , --globals
全局環境變量,在postman中定義的全局環境變量的值導出的文件路徑。
●?-d , --iteration-data
數據文件,存放數據參數的csv文件路徑。
●?-n , --iteration-count
迭代運行測試,類似在postman runner中設置的執行的次數。
●?--folder
執行目錄,如果在postman的cellection中創建的有folder,執行的folder名字。
生成報告
●?-r , --reporters
生成測試報告的數據格式。
后面支持的參數: cli, json, junit, progress and emojitrain.
可以跟多個測試報告格式。
? -r cli,json,junit
? -r cli , json,junit
JSON Reporter
參數選項 | 描述 |
--reporter-json-export ?? | 默認會在執行的目錄下生成newman 目錄,后面跟自定義目錄。 |
JUNIT/XML Reporter
參數選項 | 描述 |
--reporter-junit-export ?? | 生成xml文件報告的路徑 |
HTML Reporter
借助第三方庫可以生成html格式的報告,首先在命令行中進行安裝。
$ npm install -g newman-reporter-html
安裝成功后 使用
--reporters html
其他報告
https://www.npmjs.com/search?q=newman-reporter
Jenkins 集成
喜報來了!凡貓學員薪資最高16K!
金融行業軟件測試介紹
2020年為什么大家都開始學習自動化測試?
學習測試開發前 你需要掌握的python 代碼水平
1萬+軟件測試人員都在學的精品課程免費送,大家別錯過
總結
以上是生活随笔為你收集整理的postman安装路径_Newman进行postman脚本自动化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sql 整改措施 注入_SQL注入入侵防
- 下一篇: 用python祝福父亲节_父亲节到来 最