当前位置:网站首页>【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。
通过在文本编辑器中打开数据文件并以不同格式保存文件,确认您的数据文件已正确编码。
边栏推荐
猜你喜欢

H3C firewall rbm+vrrp networking configuration

SQLMAP使用教程(三)实战技巧二

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

Huawei BFD configuration specification

Clock in during winter vacation

MPLS test report

假设检验学习笔记

Station B Liu Erden - linear regression and gradient descent

功能安全之故障(fault),错误(error),失效(failure)

数字三角形模型 AcWing 1015. 摘花生
随机推荐
How to use the container reflection method encapsulated by thinkphp5.1 in business code
Leetcode 701 insertion operation in binary search tree -- recursive method and iterative method
Application of Lie group in gtsam
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
MPLS test report
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
[Thesis code] SML part code reading
局域网同一个网段通信过程
查询生产订单中某个(些)工作中心对应的标准文本码
如何在业务代码中使用 ThinkPHP5.1 封装的容器内反射方法
SQLMAP使用教程(三)实战技巧二
[leetcode] day96 - the first unique character & ransom letter & letter ectopic word
IPv6 comprehensive experiment
2022 software testing workflow to know
Embedded interview questions (IV. common algorithms)
异常检测方法总结
假设检验学习笔记
Eigen稀疏矩阵操作
查詢生產訂單中某個(些)工作中心對應的標准文本碼
请求转发与重定向