5

My use case is simple: I have a Postman Collection with a few requests, one of them is:

GET www.example.com/stores?country={{country}}

Then a simple Test:

pm.test("Check number of stores", function () {
  var jsonData = pm.response.json();
  pm.expect(jsonData.stores.length).to.equal(pm.iterationData.get("size"));
});

So everything is nice and merry with the following Collection data used in the Collection Runner:

country,size
UK,15
US,32

However when I simply want to run this via the main Postman window, obviously the request and the Test fails. I can set a collection variable country to SE, but I have no idea how to set size in pm.iterationData just to try if my request and test script is working fine for another "country" - without running the whole collection/iterations.

Thanks in advance for all the help!

JoSSte
  • 2,953
  • 6
  • 34
  • 54
Siaynoq
  • 452
  • 1
  • 5
  • 13

1 Answers1

1

I'm not sure if you can modify iteration data variable in runtime, but a workaround for this issue is to copy your request from the original folder into a new folder, then you can run the whole folder with only one request, you dun have then to run all the requests within the collection.

Amado Saladino
  • 2,114
  • 23
  • 25