【发布时间】:2019-10-10 05:40:34
【问题描述】:
我的用例很简单:我有一个带有几个请求的 Postman 集合,其中之一是:
GET www.example.com/stores?country={{country}}
然后是一个简单的测试:
pm.test("Check number of stores", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.stores.length).to.equal(pm.iterationData.get("size"));
});
因此,使用 Collection Runner 中使用的以下 Collection 数据一切都很好:
country,size
UK,15
US,32
但是,当我只想通过 Postman 主窗口运行它时,显然请求和测试失败了。我可以将集合变量country 设置为SE,但我不知道如何在pm.iterationData 中设置size 只是为了尝试我的请求和测试脚本是否适用于另一个“国家” - 不运行整个集合/迭代。
提前感谢所有帮助!
【问题讨论】:
标签: collections postman postman-collection-runner