postman命令行中执行,newman

postman在命令行中运行:

运行准备:

导出collecton ; 安装nodejs和npm (国内网不好访问nodejs,则使用cnpm安装Newman);  安装newman ;

运行及生成测试报告:

1、CLI reporter

2、JSON report

3、HTML reporter

4、JUnit reporter

点击运行脚本 -- 在点击右上角“Run In Command Line”(在命令行中运行) -- 会调用出来一个newman

 安装nodejs方法,详见: https://blog.csdn.net/weixin_40936211/article/details/88866358

 参考文档,安装cnpm:https://blog.csdn.net/wjnf012/article/details/80422313

1. 首先安装nodejs

   https://nodejs.org/en/下载成功后,安装好以后会默认将环境变量配置到path中。

2. 验证是否安装成功

    

3. 国内网站访问nodejs比较困难,服务器不在国内,因此需要安装cnpm

4. 安装cnpm

    npm install -g cnpm --registry=https://registry.npm.taobao.org

    

 5. 验证是否安装成功

     

 6. 安装newman

   输入命令: cnpm install newman --global

  

 7. 验证newman是否真的安装成功

    输入 newman -h

    

 使用脚本执行:

1. 导出脚本,选择V2

 

 .

 2. 执行命令:newman run v2.json -d test.txt -r html,cli,json,junit

   V2.json : 执行的脚本

   -d : 导入需要的测试数据

   -r : 导出成什么样的格式(可以导出多个格式html,cli,json,junit)

     

3.  图片显示的是cli格式,其他格式会在当前目录下的newman里面存放。

原文地址:https://www.cnblogs.com/yangguanghuayu/p/11912576.html