当前位置:网站首页>Postman核心功能解析 —— 参数化和测试报告
Postman核心功能解析 —— 参数化和测试报告
2022-07-05 18:35: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 .\执行后目录生成报告文件


最后感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走

这些资料,对于从事【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴我走过了最艰难的路程,希望也能帮助到你!凡事要趁早,特别是技术行业,一定要提升技术功底。希望对大家有所帮助…….

边栏推荐
- ConvMAE(2022-05)
- Is it safe to make fund fixed investment on access letter?
- What is text mining? "Suggested collection"
- EasyCVR电子地图中设备播放器loading样式的居中对齐优化
- Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
- 达梦数据库udf实现
- C language makes it easy to add, delete, modify and check the linked list "suggested collection"
- 2022年5月腾讯云开发者社区视频月度榜单公布
- Vulnhub's darkhole_ two
- Reptile 01 basic principles of reptile
猜你喜欢

About Estimation with Cross-Validation
![[detailed explanation of AUTOSAR 14 startup process]](/img/c4/5b08b43db97d8bb10c7207005f8c0a.png)
[detailed explanation of AUTOSAR 14 startup process]

AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务

How to write good code defensive programming

Idea configuring NPM startup

Use of websocket tool

Thoroughly understand why network i/o is blocked?

The 11th China cloud computing standards and Applications Conference | China cloud data has become the deputy leader unit of the cloud migration special group of the cloud computing standards working

The 2022 China Xinchuang Ecological Market Research and model selection evaluation report released that Huayun data was selected as the mainstream manufacturer of Xinchuang IT infrastructure!

爬虫01-爬虫基本原理讲解
随机推荐
2022年5月腾讯云开发者社区视频月度榜单公布
c期末复习
New words new words new words new words [2]
7-1 链表也简单fina
Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换
lombok @Builder注解
Thoroughly understand why network i/o is blocked?
XML basic knowledge concept
技术分享 | 接口测试价值与体系
sample_rate(采样率),sample(采样),duration(时长)是什么关系
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
FCN: Fully Convolutional Networks for Semantic Segmentation
一朵云开启智慧交通新未来
About Estimation with Cross-Validation
Is it safe for Apple mobile phone to speculate in stocks? Is it a fraud to get new debts?
XML基础知识概念
Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
[QNX Hypervisor 2.2用户手册]6.3.2 配置VM
中文版Postman?功能真心强大!
AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源