当前位置:网站首页>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自动化测试/性能/测试开发】
边栏推荐
- 中国银河证券开户安全吗 证券开户
- Hiengine: comparable to the local cloud native memory database engine
- Common interview questions in Android, 2022 golden nine silver ten Android factory interview questions hit
- Django使用mysqlclient服务连接并写入数据库的操作过程
- EasyCVR授权到期页面无法登录,该如何解决?
- UWB超宽带定位技术,实时厘米级高精度定位应用,超宽带传输技术
- 图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
- Tianyi cloud understands enterprise level data security in this way
- Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered
- The relationship between temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
猜你喜欢
如何实现游戏中的在线计时器和离线计时器
ELK分布式日志分析系统部署(华为云)
Technology sharing | interface testing value and system
Notion 类生产力工具如何选择?Notion 、FlowUs 、Wolai 对比评测
Hiengine: comparable to the local cloud native memory database engine
Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
公司破产后,黑石们来了
开源 SPL 消灭数以万计的数据库中间表
详解SQL中Groupings Sets 语句的功能和底层实现逻辑
The problem of returning the longtext field in MySQL and its solution
随机推荐
Taishan Office Technology Lecture: from the layout height of the line, talk about the height overflow and height shrinkage of the drawing height (launched in the whole network)
R language uses lubridate package to process date and time data
You can have both fish and bear's paw! Sky wing cloud elastic bare metal is attractive!
Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
Hiengine: comparable to the local cloud native memory database engine
What are the reliable domestic low code development platforms?
JAD installation, configuration and integration idea
图扑软件数字孪生智慧风电系统
Technology sharing | common interface protocol analysis
EMQX 5.0 正式发布:单集群支持 1 亿 MQTT 连接
如何快速进阶自动化测试?听听这3位BAT大厂测试工程师的切身感想....
Debezium系列之:记录mariadb数据库删除多张临时表debezium解析到的消息以及解决方法
Mysql database indexing tutorial (super detailed)
MySQL中字段类型为longtext的值导出后显示二进制串方式
After the company went bankrupt, the blackstones came
PHP利用ueditor实现上传图片添加水印
Why can't Bi software do correlation analysis? Take you to analyze
Password reset of MariaDB root user and ordinary user
Debezium系列之:IDEA集成词法和语法分析ANTLR,查看debezium支持的ddl、dml等语句
618“低调”谢幕,百秋尚美如何携手品牌跨越“不确定时代”?