当前位置:网站首页>【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。
通过在文本编辑器中打开数据文件并以不同格式保存文件,确认您的数据文件已正确编码。
边栏推荐
- [ram IP] introduction and experiment of ram IP core
- Analysis report on development trends and investment planning of China's methanol industry from 2022 to 2028
- J'ai un chaton.
- [happy Spring Festival] if you feel happy, dance
- wib3.0 跨越,在跨越(ง •̀_•́)ง
- Classes and objects (I) detailed explanation of this pointer
- nodejs实现微博第三方登录
- Detailed explanation of BF and KMP
- Pay attention to the details of pytoch code, and it is easy to make mistakes
- Dynamic programming -- knapsack problem
猜你喜欢

Detailed explanation of BF and KMP

Application du Groupe Li dans gtsam

First knowledge database

Web service connector: Servlet

Hongliao Technology: how to quickly improve Tiktok store

Application of Lie group in gtsam

J'ai un chaton.

properties文件

Analysis report on development trends and investment planning of China's methanol industry from 2022 to 2028

VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator
随机推荐
数学三大核心领域概述:代数
PAT(乙级)2022年夏季考试
功能安全之故障(fault),错误(error),失效(failure)
查询生产订单中某个(些)工作中心对应的标准文本码
IDEA 新UI使用
[email protected] raspberry pie
IP day 16 VLAN MPLS configuration
[C language syntax] the difference between typedef struct and struct
Hongliao Technology: Liu qiangdong's "heavy hand"
Go language -- language constants
Buuctf-[gxyctf2019] no dolls (xiaoyute detailed explanation)
GTSAM中李群的运用
How to recover Huawei router's forgotten password
Web服务连接器:Servlet
养了只小猫咪
H3C V7版本交换机配置IRF
误差的基本知识
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
授予渔,从0开始搭建一个自己想要的网页
Dynamic programming -- knapsack problem