0
votes

I see multiple tutorials about Postman/Newman test scripts, however they mostly looks like single requests.

What is the best way to chain Postman test request based on previous results, so eg:

  • PUT upload request
  • Test for e.g. status code. If 200, do POST start-processing the just uploaded file, else stop
  • If 200, then do GET to query
  • If 200, check JSON against fixed expected JSON output.

Newman seems to run an entire collection independently. I only want to run request 1, which then fires request 2 and request 3 based on output of previous request in that same collection.

1

1 Answers

2
votes

You can configure this in the Tests section in Postman by using

if (condition) {
    postman.setNextRequest("NAME OF YOUR REQUEST")
}