从命令行中运行collocation
运行准备
-
导出collocation
-
安装nodejs和npm(Nodejs下的包管理器)
下载地址https://nodejs.org/zh-cn/download/,下载安装后自带npm
-
安装newman
安装过程有点慢,安装完成后如下所示,newman -h查看具体用法
运行及生成测试报告
- CLI reporer
- JSON reporter
- HTML reporter
- Junit reporter
示例
newman run .\v2ex.postman_collection.json -d .\testdata.json -r html
报错解决方案
报错1、“newman : 无法加载文件 C:\Users\...\AppData\Roaming\npm\newman.ps1,因为在此系统上禁止运行脚本”
解决方法如下:
- 以管理员身份运行命令行cmd
- 更改策略,命令行输入set-ExecutionPolicy RemoteSigned,修改改权限为A,在输入 get-ExecutionPolicy 查看当前的状态
报错2、newman: could not find "html……
解决方法:npm install -g newman-reporter-html