0

Let's say my API call URL is www.example.com/quiz with POST method.

And I get the response body like this. And

var jsonData = pm.response.json();

pm.collectionVariables.set("cv_quiz_order", quiz_order)
if(!jsonData.is_end){
   // TODO: request next question using `quiz_order`
}else{
   // TODO: finish this API and go to the next request.
}

When I use Run Collection. I want it(the Apis) tests one by one in regular sequence. And only this Api repeats until its is_end is true.

How can I do this?

c-an
  • 3,543
  • 5
  • 35
  • 82

1 Answers1

0
var jsonData = pm.response.json();

pm.collectionVariables.set("cv_quiz_order", quiz_order)
if(!jsonData.is_end){
  postman.setNextRequest(pm.info.requestName)
}else{
   // TODO: finish this API and go to the next request.
}

this will keep sending the same request until is_end is true

postman.setNextRequest allows you to set the next reqeust to be executed , pm.info.requestName gives thecurrent request Name , so you are saying run this request as next request

PDHide
  • 18,113
  • 2
  • 31
  • 46