zoukankan      html  css  js  c++  java
  • Postman接口测试_Newman运行集合脚本

    一、前言

          Newman是Postman的命令行集合运行器。可以直接运行接口集合脚本。

          安装Newman这里不概述,自行百度安装。注意:安装前需安装Node.js

          Newman更多用法见:https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/

    二、Newman常见的参数

           --folder :从集合中指定运行的单个文件夹

           --e:指定环境变量的路径,运行其Json文件

           --g:指定全局变量的路径,运行其Json文件

           --d:指定一个数据文件,Json/CSV格式文件。

           --n:设置集合迭代的次数

           --delay-request:设置每个请求间隔时间,单位是ms

           --timeout-request:设置一个请求的请求超时时间,ms

           --bail:当测试用例失败时停止运行程序,0是失败,1是成功

           --x,--supress-exit-code:即使在失败后仍继续运行测试,但以代码=0退出

           --r :生成测试报告,用法:newman run <文件名> -r <类型> --reporter-<类型>-export <报告名称>.<类型>

                 可以生成cli,json,junit,progress,emojitrain,html类型的测试报告,默认是cli

            参考下列实例:

            (1)newman run D:自我提升能眼接口集.postman_collection.json  -e D:自我提升测试环境.postman_environment.json  -g D:自我提升Workspace.postman_globals.json   -r html --reporter-html-export   D: ame.html

            运行以上脚本后,打开D盘,查看测试报告name.html,如下:

           

           (2) newman run D:能眼接口集.postman_collection.json -e D:Postman接口测试测试环境.postman_environment.json -g D:Workspace.postman_globals.json --bail newman

                     

  • 相关阅读:
    C#在WebApi 中使用Redis 的方法
    IList<> IEnumerable<> ReadOnlyCollection<> 使用方向
    winform DateTimePicker 设置成秒
    vs 在高分屏下开发 winform 配置
    eclipse spring插件
    request方法
    Nexus添加中央仓库
    eclipse 安装velocity插件
    java >> << .>>> 计算详解
    SheetJS 入门案例
  • 原文地址:https://www.cnblogs.com/balllyh/p/13071343.html
Copyright © 2011-2022 走看看