• Postman核心功能解析-参数化和测试报告


    1.参数化处理

    参数化:针对于某一个接口,有大量的的测试数据需要批量验证,一个一个的更改请求参数太耗时耗力,使用参数化批量处理数据会比较高效,常规通过文档参数化实现。

    创建文件 格式CSV
    在这里插入图片描述
    在这里插入图片描述
    文件内第一行信息 需要和参数变量匹配

    批量执行
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    添加断言数据
    在这里插入图片描述

    2. Postman生成测试报告

    Postman使用runner运行时,生成的报告只能在Postman内部查看,并不是很方便。所以可以生成一个HTML报告,通过浏览器打开即可

    Postman需要生成HTML报告需要使用newman,借助newman工具生成。

    2.1安装newman

    newman是使用node.js开发,专门为postman做的生成测试报告的工具插件。我们需要安装node.js、newman、newman插件:newman-reporter-html

    下载node.js:https://nodejs.org/en/ 建议安装15或者16版本

    npm install -g cnpm –

    registry=https://registry.npm.taobao.org安装newman:打开cmd,输入npm install -g newman

    安装newman-reporter-html打开cmd,输入npm install -g newman-reporter-html

    2.2newman命令运行用例

    newman run 用例集.json -e 环境文件.json -d 数据文件.json -r html --repoter-html-export report.html

    newman run 用例集.json运行用例集的意思

    -e 环境文件.json 指定运行的环境

    -d 数据文件.json 指定运行的数据

    -r html 生成html报告

    –reporter-html-export report.html 指定html报告名称是report.html

    执行前需要导出脚本/数据文件/环境文件例如:
    在这里插入图片描述
    执行后目录生成报告文件

    在这里插入图片描述

  • 相关阅读:
    应用层协议 -- HTTPS 协议
    MFC|选择获取文件路径
    05.STLvector、list、stack、queue
    springcloud和分布式微服务学习笔记
    AI学习指南机器学习篇-KNN基本原理
    word文档怎么删除多余的空白页?
    文献阅读总结(3)Neural Graph Collaborative Filtering
    分布式重点知识总结
    服务器常用的异常及性能排查
    Babylonjs学习笔记(二)——创建基本材质
  • 原文地址:https://blog.csdn.net/m0_53918927/article/details/125620300