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


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



参数化断言

添加断言数据
// 设置变量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 .\
执行后目录生成报告文件

最后: 可以在公众号:伤心的辣条 ! 自行领取一份216页软件测试工程师面试宝典文档资料【免费的】。以及相对应的视频学习教程免费分享!,其中包括了有基础知识、Linux必备、Shell、互联网程序原理、Mysql数据库、抓包工具专题、接口测试工具、测试进阶-Python编程、Web自动化测试、APP自动化测试、接口自动化测试、测试高级持续集成、测试架构开发测试框架、性能测试、安全测试等。
我推荐一个【Python自动化测试交流群:746506216】,大家可以一起探讨交流软件测试,共同学习软件测试技术、面试等软件测试方方面面,助你快速进阶Python自动化测试/测试开发,走向高薪之路。
喜欢软件测试的小伙伴们,如果我的博客对你有帮助、如果你喜欢我的博客内容,请 “点赞” “评论” “收藏” 一 键三连哦!
边栏推荐
- Function of contenttype
- 假设检验学习笔记
- Thoughts on data security (Reprint)
- J'ai un chaton.
- What are the test sites for tunnel engineering?
- Accélération de la lecture vidéo de l'entreprise
- Baidu online AI competition - image processing challenge: the 8th program of handwriting erasure
- My 2021
- Coordinatorlayout+nestedscrollview+recyclerview pull up the bottom display is incomplete
- GTSAM中李群的運用
猜你喜欢

GTSAM中李群的運用

关于 PHP 启动 MongoDb 找不到指定模块问题

Sqlmap tutorial (III) practical skills II
![[ram IP] introduction and experiment of ram IP core](/img/34/1c988456e32a8e9840d1d073caefbf.jpg)
[ram IP] introduction and experiment of ram IP core

Network protocol model

HCIA review

Report on the competition status and investment decision recommendations of Guangxi hospital industry in China from 2022 to 2028

Coordinatorlayout+nestedscrollview+recyclerview pull up the bottom display is incomplete

c语言——冒泡排序

Application du Groupe Li dans gtsam
随机推荐
Embedded point test of app
VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator
ContentType的作用
【论文阅读】NFlowJS:基于鲁棒学习的合成负数据密集异常检测
Gtest之TEST宏的用法
PAT(乙级)2022年夏季考试
Eigen稀疏矩阵操作
CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全
Nodejs realizes the third-party login of Weibo
10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
【微信小程序】搭建开发工具环境
Introduction to promql of # yyds dry goods inventory # Prometheus
H3C V7 switch configuration IRF
Application of Lie group in gtsam
LeetCode 731. 我的日程安排表 II
如何在业务代码中使用 ThinkPHP5.1 封装的容器内反射方法
[ram IP] introduction and experiment of ram IP core
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Manhattan distance sum - print diamond
功能安全之故障(fault),错误(error),失效(failure)