当前位置:网站首页>【Postman】Collections-运行配置之导入数据文件
【Postman】Collections-运行配置之导入数据文件
2022-07-06 05:59:00 【lichong951】
您可以使用数据文件传递 Postman 值集以在收集运行中使用。通过在 Collection Runner 中选择 JSON 或 CSV 数据文件,您可以在一次运行中使用多个不同的值测试您的请求。
使用数据文件运行集合
当您启动收集运行时,您将看到一个选择数据文件的选项。选择Postman 右下角的Runner 。
选择您的集合,然后选择右侧数据旁边的选择文件以选择您的数据文件。
在开始运行之前,您将看到一个预览文件中数据data.json的选项。
[{
"path": "post",
"value": "1"
}, {
"path": "post",
"value": "2"
}, {
"path": "post",
"value": "3"
}, {
"path": "post",
"value": "4"
}]

选择使用数据文件运行以使用文件中的值开始运行。
Collection Runner 将为数据文件中的每次迭代运行收集请求。您看到的输出将指示您在收集请求中定义的任何测试的结果。
访问数据文件值
您可以在整个请求中引用数据文件中定义的值,但是要在脚本中访问它们,您需要使用不同的技术。要在测试或请求前脚本代码中使用数据文件中的值,请使用iterationData,它提供对用于运行请求的当前数据文件记录的访问。
//get the 'value' field from the data file for this request run
pm.iterationData.get("value")
您在请求中定义的任何数据都将在集合运行时使用,并且您的请求数据可以引用数据文件中定义的值。
读取数据文件时出错
当 Postman 在收集运行期间尝试读取您的数据文件时,您可能会遇到错误。如果发生这种情况,您可以采取以下步骤。
确保您的数据文件格式正确,为 CSV 或 JSON。
通过在文本编辑器中打开数据文件并以不同格式保存文件,确认您的数据文件已正确编码。
边栏推荐
- [string] palindrome string of codeup
- LTE CSFB process
- The difference and usage between continue and break
- 请求转发与重定向
- How to recover Huawei router's forgotten password
- Li Chuang EDA learning notes 12: common PCB board layout constraint principles
- Caused by:org.gradle.api.internal.plugins . PluginApplicationException: Failed to apply plugin
- Query the standard text code corresponding to a work center (s) in the production order
- High quality coding tool clion
- 入侵检测领域数据集总结
猜你喜欢

c语言——冒泡排序

H3C防火墙RBM+VRRP 组网配置

CoDeSys note 2: set coil and reset coil

Is it difficult for an information system project manager?

Market development prospect and investment risk assessment report of China's humidity sensor industry from 2022 to 2028

LTE CSFB process

Li Chuang EDA learning notes 12: common PCB board layout constraint principles

Station B, Master Liu Er - dataset and data loading

養了只小猫咪

异常检测方法总结
随机推荐
Is it difficult for an information system project manager?
华为路由器如何配置静态路由
IP day 16 VLAN MPLS configuration
2022 software testing workflow to know
The difference and usage between continue and break
Pay attention to the details of pytoch code, and it is easy to make mistakes
OSPF configuration command of Huawei equipment
关于 PHP 启动 MongoDb 找不到指定模块问题
Buuctf-[gxyctf2019] no dolls (xiaoyute detailed explanation)
Configuring OSPF GR features for Huawei devices
Some easy-to-use tools make your essay style more elegant
Web服务连接器:Servlet
【课程笔记】编译原理
Amazon Engineer: eight important experiences I learned in my career
《卓有成效的管理者》读书笔记
[Baiwen smart home] first day of the course_ Learn Embedded and understand the development mode of bare metal and RTOS
Function of contenttype
GTSAM中李群的運用
Linux regularly backs up MySQL database
Baidu online AI competition - image processing challenge: the 8th program of handwriting erasure