【Postman+Newman】接口自动化测试以及测试报告输出

Newman+postman自动化测试

  • postman
    • Pre-request Script前置脚本
  • Newman
    • 测试报告输出

postman

学习postman脚本编写

Pre-request Script前置脚本

Newman

测试报告输出

输出报告时使用的命令:
    -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

执行命令后生成结果
在这里插入图片描述

htmlextra 使用
  使用htmlextra套件生成比较高级的html报告
  使用方法和html的相同,需要安装htmlextra,命令行中输入:
  npm install -g newman-reporter-htmlextra
  命令行中执行命令生成测试报告
  newman run APITest.postman_collection.json -r htmlextra --reporter-html-export htmlReport.html
  执行后生成测试报告文件:
  在这里插入图片描述
在这里插入图片描述

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-21 17:18:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-21 17:18:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-21 17:18:03       87 阅读
  4. Python语言-面向对象

    2024-02-21 17:18:03       96 阅读

热门阅读

  1. 怎样重置ubuntu mysql8密码

    2024-02-21 17:18:03       52 阅读
  2. ARM体系架构

    2024-02-21 17:18:03       45 阅读
  3. 【python】使用OpenCV进行行人检测

    2024-02-21 17:18:03       57 阅读
  4. NebulaGraph学习笔记-自定义池连接

    2024-02-21 17:18:03       44 阅读
  5. vue学习笔记

    2024-02-21 17:18:03       52 阅读
  6. 为什么使用 Redis,不用 Memcache 和 MongoDB?

    2024-02-21 17:18:03       48 阅读
  7. ADO.NET查询返回单个值

    2024-02-21 17:18:03       50 阅读
  8. 抽象方法与设计模式

    2024-02-21 17:18:03       47 阅读