0

I'm running test cases using postman for different API calls. Running multiple REST APIs require different datafile. Also, I need to access different rows of the same datafile. Is there a way to implement this using postman?

I'm seeing a restriction where one collection can access only one datafile. And each row can be accessed only by respective iteration. Ex: 1st row can be accessed by only 1st iteration of the collection, 2nd row by 2nd iteration and so on. Is there a way to break and define the way we want to access different datasets?

viz
  • 51
  • 8

1 Answers1

2

After pouring through the postman documentation and multiple blogs I don't believe this is currently possible.

The way I have got around this is to allow the iteration to reach the end of the collection and to flip back to the first request which is just there to control the loop, It just calls GET postman.echo?Iteration={{pm.info.iteration}} and contains the script

if(pm.info.iteration > 0)
{
     setNextRequest(requestName);
}

I then structure my collection like so:

  1. SetNextRequest (after the first loop this script will skip to Request 3)
  2. Request 1 (Only executes on first iteration)
  3. Request 2 (Only executes on first iteration)
  4. Request 3 (Executes with every iteration with an iterated dataset)

Hopefully a better solution will be released by the postman team soon!

Cheers, Sam

Sam Barber
  • 458
  • 1
  • 6
  • 13