使用newman自动测试
newman介绍
Newman相当于是postman命令行,可以使用postman导出的json测试集来进行自动化测试。
地址:https://github.com/postmanlabs/newman
newman安装
手动安装
newman依赖node.js/npm环境。
nodejs官网下载lts版本:https://nodejs.org/en/
node安装,与环境变量配置。参考:https://www.cnblogs.com/liluxiang/p/9592003.html
安装newman:
npm install newman -g
然后就可以在命令行使用了
newman run /file/path/of/collection.json -e /file/path/of/enviroment.json
docker安装
下载安装自己平台下docker客户端。(docker是Linux应用容器,理论上Linux宿主机兼容性最好)。
我的电脑是win10系统,安装docker的过程中会要求使用window wsl安装linux子系统。
按照指示说明安装、重启就好。
#从registory仓库拉取应用程序镜像,
#默认的registory是hub.docker.com,可以上传、搜索自己需要的应用程序镜像。
docker pull postman/newman;
#docker run命令用于运行某个docker应用程序
#-t参数表示分配一个tty连接到命令行,用于展示结果
#后面的是newman的CLI命令及参数
docker run -t postman/newman run /file/path/of/collection.json -e /file/path/of/enviroment.json
发表回复