zoukankan      html  css  js  c++  java
  • Newman+postman输出report

    • 下载安装nodejs:http://nodejs.cn/download/
    • 安装Newman:npm install -g newman
    • 安装HTML报告:npm install -g newman-reporter-html
    • Newman简单用法
      1、运行从postman导出的json/上传到服务器的url
      newman run [options] <collection> URL or path to a Postman Collection
      

        

      2、输出报告时使用的命令:
      -r html,json,junit 指定生成html,json,xml形式的测试报告
      --reporter-json-export jsonReport.json 生成json格式的测试报告
      --reporter-junit-export xmlReport.xml 生成xml格式的测试报告
      --reporter-html-export htmlReport.html 生成html格式的测试报告
      默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下
      

       例如输出json和html文件报告:

      newman run APITest.postman_collection.json -r html,json --reporter-json-export jsonReport.json --reporter-html-export htmlReport.html
      

        
      3、指定环境/全局变量路径

      指定环境变量路径:-e source
      指定全局变量路径:-g source

      例如:

      newman run ~/Desktop/example.postman_collection.json -e ~/Desktop/DEV.postman_environment.json -g ~/Desktop/global.postman_collection.json


      4、设置重复执行次数

      newman run APITest.postman_collection.json -n 次数
      

        
      5、查看其它可用参数

      newman run -h
      

        

      # 命令介绍
      
      newman run   用例名称   [-e | -r | -d  | -g  -n  - export-environment | -timeout (ms)   | -timeport-request (ms)  | -timeout-script (ms)]
      
      # -e 环境变量地址
      
      # -r 生成报告格式
      
      # -d 需要用的测试数据
      
      # -g 全局变量地址
      
      # -n  迭代执行几次
      
      # -export-environment  导出文件执行的环境变量路径
      
      # -timeout (ms)  设置整个集合运行完成执行的时间
      
      # –timeport-request (ms)   指定等待请求返回响应的时间
      
      # -timeout-script (ms)指定等待脚本执行完成的时间
    • htmlextra 使用

      htmlextra套件生成相对好看的html报告,执行命令:

      npm install -g newman-reporter-htmlextra
      

      命令行中执行命令生成测试报告

      newman run APITest.postman_collection.json -r htmlextra --reporter-html-export htmlReport.html
  • 相关阅读:
    P24—动态数组没有{}
    JavaB站学习————接口在开发中的作用
    JavaB站学习————extends和implements同时出现
    JavaB站学习————一个类可以实现多个接口以及接口的总结
    JavaB站学习————接口和多态联合使用。
    01日语五十音
    07 递归&&命名风格&&作业(结构体,malloc,函数,递归)
    JavaB站学习——作业16
    电子书
    破解压缩包
  • 原文地址:https://www.cnblogs.com/qianmaoliugou/p/13219267.html
Copyright © 2011-2022 走看看