当前位置:网站首页>Postman核心功能解析-参数化和测试报告
Postman核心功能解析-参数化和测试报告
2022-07-05 19:03:00 【小梧敲代码】
1. 参数化处理
参数化:针对于某一个接口,有大量的的测试数据需要批量验证,一个一个的更改请求参数太耗时耗力,使用参数化批量处理数据会比较高效,常规通过文档参数化实现。

文件内第一行信息 需要和参数变量匹配
批量执行


参数化断言
添加断言数据
// 设置变量assert
assert = pm.variables.get("assert");
// 断 言 message 字 段 值 为 success
pm.test("message字段值为success", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.message).to.eql(assert);
});
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
执行前需要导出脚本/数据文件/环境文件例如:
newman run token.postman_collection.json -d logindata.txt -e pinter项目.postman_environment.json -n 3 -r html --reporter-html-export .\
执行后目录生成报告文件
最后感谢每一个认真阅读我文章的人,下面这个网盘链接也是我费了几天时间整理的非常全面的,希望也能帮助到有需要的你!

这些资料,对于想转行做【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴我走过了最艰难的路程,希望也能帮助到你!凡事要趁早,特别是技术行业,一定要提升技术功底。希望对大家有所帮助……
如果你不想一个人野蛮生长,找不到系统的资料,问题得不到帮助,坚持几天便放弃的感受的话,可以点击下方小卡片加入我们群,大家可以一起讨论交流,里面会有各种软件测试资料和技术交流。
| 点击文末小卡片领取 |
敲字不易,如果此文章对你有帮助的话,点个赞收个藏来个关注,给作者一个鼓励。也方便你下次能够快速查找。
自学推荐B站视频:
零基础转行软件测试:25天从零基础转行到入职软件测试岗,今天学完,明天就业。【包括功能/接口/自动化/python自动化测试/性能/测试开发】
边栏推荐
- Tianyi cloud understands enterprise level data security in this way
- China law network joins hands to observe the cloud, and the online system is a full link observable platform
- 手机开户选择哪家券商公司比较好哪家平台更安全
- android中常见的面试题,2022金九银十Android大厂面试题来袭
- 图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
- Fuzor 2020軟件安裝包下載及安裝教程
- 100million single men and women supported an IPO with a valuation of 13billion
- 华为让出的高端市场,小米12S靠徕卡能抢到吗?
- The binary string mode is displayed after the value with the field type of longtext in MySQL is exported
- 2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】
猜你喜欢

公司破产后,黑石们来了

Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接

Thoroughly understand why network i/o is blocked?

从外卖点单浅谈伪需求

cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】

微波雷达感应模块技术,实时智能检测人体存在,静止微小动静感知

#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
MySql中的longtext字段的返回问题及解决

Oracle故障处理:Ora-10873:file * needs to be either taken out of backup or media recovered

Analysis of postman core functions - parameterization and test report
随机推荐
Debezium系列之:解析默认值字符集
Teach you to deal with JS reverse picture camouflage hand in hand
CDB 实例的启动与关闭
Tupu software digital twin | visual management system based on BIM Technology
如何快速进阶自动化测试?听听这3位BAT大厂测试工程师的切身感想....
flume系列之:拦截器过滤数据
决策树与随机森林
Oracle Chinese sorting Oracle Chinese field sorting
Hiengine: comparable to the local cloud native memory database engine
国海证券在网上开户安全吗?
Go语言 | 03 数组、指针、切片用法
手机开户选择哪家券商公司比较好哪家平台更安全
华律网牵手观测云,上线系统全链路可观测平台
为什么 BI 软件都搞不定关联分析?带你分析分析
The monthly list of Tencent cloud developer community videos was released in May 2022
Go语言 | 02 for循环及常用函数的使用
Tupu software digital twin smart wind power system
Tianyi cloud understands enterprise level data security in this way
Windows Oracle open remote connection Windows Server Oracle open remote connection
Advanced application of C # language