如何在Postman中运行JSON测试数据?

时间:2019-06-21 02:08:57

标签: postman-collection-runner

我可以运行以下链接中提供的CSV测试数据。但无法运行Json测试数据。

https://learning.getpostman.com/docs/postman/collection_runs/running_multiple_iterations/

端点: https://postman-echo.com/get?city= {{City}}&ramen = {{Ramen}}

Json测试数据链接: https://s3.amazonaws.com/postman-static-getpostman-com/postman-docs/ramen.json

我使用的代码:

pm.test("Body contains City", function () {
    pm.expect(pm.response.text()).to.include(pm.iterationData.get("City"));
    // older syntax still works too: with dot or bracket notation
    pm.expect(pm.response.text()).to.include(data.City); 
    console.log("City to be sent: " + data["City"]); 
});

我想要所有JSON测试数据迭代的测试结果。但是,当通过CollectionRunner运行时,我在Collection和Postman Console中都获得了First Iteration的价值。但是当运行CSV文件时,我可以看到35个迭代的结果。

告诉我如何获取35个JSON迭代的测试结果。

0 个答案:

没有答案