文章目录
- 一、简介
- 二、Postman安装和插件newman
- 2.1 Postman安装
- 2.1.1 Postman安装方式
- 2.1.2 Postman注意事项
- 2.2 安装Postman插件newman
- 2.2.1 安装node.js
- 2.2.2 安装newman (前提:确保 npm -v 验证通过)
- 2.2.2.1 npm install报错ERR code ETIMEDOUT的解决办法
- 2.2.2.2 安装newman显示required node version >=16解决办法
- 2.3 安装newman-reporter-htmlextra
一、简介
Postman是一款非常流行的接口调试工具,它使用简单,而且功能也很强大。不仅测试人员会使用,开发人员也会经常使用。
官方网址:https://www.postman.com/
主要特点:
- 简单易用的图形用户界面
- 可以保存接口请求的历史记录
- 使用测试集Collections可以更有效的管理组织接口
- 可以在团队之间同步接口数据
二、Postman安装和插件newman
2.1 Postman安装
2.1.1 Postman安装方式
方式1:
- Postman最早是以Chrome浏览器插件的形式存在的,可以到chrome商店搜索下载安装。由于2018年初Chrome停止对Chrome应用程序的支持,所以不再推荐使用该方式。
方式2:
- Postman提供了独立的安装包,不再依赖于Chrome浏览器了。同时支持MAC、Windows和Linux,推荐使用这种方式安装。
- 下载地址:https://www.postman.com/apps
2.1.2 Postman注意事项
- 一旦安装成功,尽量坚持使用不要卸载!
- Postman有个BUG,不能重复安装,如果重复安装,新安装的版本 必须 大于已安装的版本。
2.2 安装Postman插件newman
要想给Postman安装插件newman,必须安装 node.js 。
2.2.1 安装node.js
1、下载安装 node.js:https://nodejs.org/zh-cn/download/package-manager
2、验证:使用 win+r,输 cmd 打开终端,输入命令 npm -v,如能显示版本号(版本略有差异无所谓)。代表 node.js 安装成功。
C:\Users\ggk>npm -v6.14.42.2.2 安装newman (前提:确保 npm -v 验证通过)
1、安装newman时,必须保证 node.js 已经装成功!
2、在线安装和验证命令:
# 1、安装命令(使用管理员身份启动终端,写入命令)C:\Users\ggk>npminstall-g newman# 2、验证安装C:\Users\ggk>newman -v5.2.22.2.2.1 npm install报错ERR code ETIMEDOUT的解决办法
# 1. 清空缓存npmcache clean --force# 2. 切换新源npmconfigsetregistry https://registry.npmmirror.com# 3. 查看源是否设置成功npmconfig get registry# 4. 可以正常安装需要的工具了npminsatll xxx2.2.2.2 安装newman显示required node version >=16解决办法
# 验证安装C:\Users\ggk>newman -v newman: required node version>=16-----------------------------------------------------------------# 解决办法,直接安装对应版本就行。C:\Users\ggk>npminstall-g newman@5.2.2npmWARN deprecated uuid@3.4.0: Please upgrade to version7or higher. Older versions may use Math.random()incertain circumstances,whichis known to be problematic. See https://v8.dev/blog/math-randomfordetails.npmWARN deprecated har-validator@5.1.5: this library is no longer supported C:\Users\ggk\AppData\Roaming\npm\newman ->C:\Users\ggk\AppData\Roaming\npm\node_modules\newman\bin\newman.js + newman@5.2.2 added54packages from53contributors, removed14packages and updated31packagesin24.125s C:\Users\ggk>newman -v5.2.22.3 安装newman-reporter-htmlextra
# 安装命令C:\Users\ggk>npminstall-g newman-reporter-htmlextranpmWARN newman-reporter-htmlextra@1.0.5 requires a peer of newman@4 but none is installed. You mustinstallpeer dependencies yourself.# 看下面类似信息,代表安装完成。+ newman-reporter-htmlextra@1.0.5 added12packages from44contributorsin3.873s ———————————————————————————————————————————————————————————————————————————— 注意:有的电脑不支持,可以安装:newman-reporter-html