newman安装以及生成HTML report

一、安装newman之前需先下载安装node.js
1、node.js 链接: https://pan.baidu.com/s/11-Bg7iCjEMtwcfI_nceVVw 提取码: pye5
下载安装之后打开cmd,
键入命令

node -v 

可以查看到node.js版本表示安装成功
2、开始安装newman

npm install -g newman

安装过程可能有点久,需要等待几分钟
1)假如在安装过程中出现了error,安装失败的情况,那么则需要输入以下命令

npm config set strict-ssl false

ps:每次打开cmd运行报错时都需输入以上命令(已踩坑)
2)这种情况出现的原因是在NodeJS中默认是不接受“不受信任或无效的SSL证书”软件的安装的,所以说我们要想安装该软件,那么我们就得关闭NodeJS的证书检查功能,命令如上

3、查看newman是否安装成功

 newman -v

以上,就成功将newman安装了,可以开始运行接口的一系列测试了!

二、安装htmlreport以及生成html reporrt
1、安装html report插件

npm install newman-reporter-html 

2、使用postman导出的json文件或者是https链接
newman run http链接/.json文件 -r html --reporter-html-export 本地路径

eg:

newman run https://www.getpostman.com/collections/313da2a16d364407f666 -r html --reporter-html-export C:\Users\Lenovo\Desktop

猜你喜欢

转载自blog.csdn.net/Gchen00/article/details/88823253