当前位置:网站首页>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自动化测试/性能/测试开发】
边栏推荐
- Get wechat avatar and nickname with uniapp
- Go语言 | 02 for循环及常用函数的使用
- 公司破产后,黑石们来了
- Why can't Bi software do correlation analysis? Take you to analyze
- Redhat7.4 configure Yum software warehouse (rhel7.4)
- 2022最新大厂Android面试真题解析,Android开发必会技术
- 100million single men and women supported an IPO with a valuation of 13billion
- PHP利用ueditor实现上传图片添加水印
- 从外卖点单浅谈伪需求
- 尚硅谷尚优选项目教程发布
猜你喜欢
Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered
C# 语言的基本语法结构
A cloud opens a new future of smart transportation
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
Windows Oracle open remote connection Windows Server Oracle open remote connection
word如何转换成pdf?word转pdf简单的方法分享!
android中常见的面试题,2022金九银十Android大厂面试题来袭
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
随机推荐
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
PG基础篇--逻辑结构管理(用户及权限管理)
Get wechat avatar and nickname with uniapp
JS解力扣每日一题(十二)——556. 下一个更大元素 III(2022-7-3)
Fuzor 2020软件安装包下载及安装教程
决策树与随机森林
【AI 框架基础技术】自动求导机制 (Autograd)
Technology sharing | common interface protocol analysis
Common interview questions in Android, 2022 golden nine silver ten Android factory interview questions hit
Django uses mysqlclient service to connect and write to the database
Fuzor 2020軟件安裝包下載及安裝教程
EasyCVR授权到期页面无法登录,该如何解决?
强化学习-学习笔记4 | Actor-Critic
泰山OFFICE技术讲座:由行的布局高度,谈绘制高度的高度溢出、高度缩水(全网首发)
CDB 实例的启动与关闭
A cloud opens a new future of smart transportation
Go语言学习教程(十五)
flume系列之:拦截器过滤数据
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Mysql如何对json数据进行查询及修改