当前位置:网站首页>【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。
通过在文本编辑器中打开数据文件并以不同格式保存文件,确认您的数据文件已正确编码。
边栏推荐
- MIT6.s081-2020 Lab2 System Calls
- [happy Spring Festival] if you feel happy, dance
- 关于 PHP 启动 MongoDb 找不到指定模块问题
- First knowledge database
- [Thesis code] SML part code reading
- H3C防火墙RBM+VRRP 组网配置
- wib3.0 跨越,在跨越(ง •̀_•́)ง
- Configuring OSPF GR features for Huawei devices
- 误差的基本知识
- Interface test: what are the components of the URL in fiddler
猜你喜欢
Wib3.0 leapfrogging, in leapfrogging (ง • ̀_•́) ง
Embedded point test of app
Application of Lie group in gtsam
Baidu online AI competition - image processing challenge: the 8th program of handwriting erasure
【无标题】
ContentType的作用
Buuctf-[[gwctf 2019] I have a database (xiaoyute detailed explanation)
【课程笔记】编译原理
Caused by:org.gradle.api.internal.plugins . PluginApplicationException: Failed to apply plugin
误差的基本知识
随机推荐
C language learning notes (mind map)
查詢生產訂單中某個(些)工作中心對應的標准文本碼
Cognitive introspection
Linux regularly backs up MySQL database
Redistemplate common collection instructions opsforvalue (II)
Application du Groupe Li dans gtsam
Hongliao Technology: how to quickly improve Tiktok store
关于 PHP 启动 MongoDb 找不到指定模块问题
华为路由器如何配置静态路由
[course notes] Compilation Principle
数字三角形模型 AcWing 1015. 摘花生
授予渔,从0开始搭建一个自己想要的网页
A master in the field of software architecture -- Reading Notes of the beauty of Architecture
GTSAM中李群的運用
[email protected] raspberry pie
Analysis report on development trends and investment planning of China's methanol industry from 2022 to 2028
Title 1093: character reverse order
LAN communication process in the same network segment
isam2运行流程
Processes and threads