【问题标题】:how to run multiple Api from test runner which multiple set of data如何从多个数据集的测试运行器运行多个 Api
【发布时间】:2021-12-27 20:05:52
【问题描述】:
我有多个 API,每个 api 将使用数据表中的一个测试数据并执行它。是否可以在邮递员中检查这种情况。
假设我有 Api a' api b aoi c
api a 将从 excel 中读取第一行数据' api b 将读取第二行数据等
【问题讨论】:
标签:
postman
postman-collection-runner
【解决方案1】:
我认为这是不可能的,但是,另一种解决方案是创建从数据文件变量派生的单个请求并为每个 API 构建多个数据文件。
导出您的集合并使用 newman cli 执行集合并附加数据文件。您必须对每个文件多次运行 newman。像这样
newman run "my.exported.postman_collection.json" -r "cli,html,json,junit" -n 1 --iteration-data "d:\my.first.file.csv"
newman run "my.exported.postman_collection.json" -r "cli,html,json,junit" -n 1 --iteration-data "d:\my.second.file.csv"
newman run "my.exported.postman_collection.json" -r "cli,html,json,junit" -n 1 --iteration-data "d:\my.third.file.csv"
更多关于newman cli的信息:https://learning.postman.com/docs/running-collections/using-newman-cli/command-line-integration-with-newman/