0

I am running a collection runner to execute multiple test cases in Postman

I have a Postman folder, where I have created a POST request. In the body of the request, I provide something like this:

{
  "subscriber": {{name}},
  "action": {{action}}
}

I am fetching the value for a name from the .json file, that I am passing in Collection Runner, which contains multiple test cases in it.

Sample JSON file I'm passing:

[
 {
  "name":"abc",
  "action":"add"
 },
{
  "name":"xyz",
  "action":"sub"
 }
]

It works perfectly, but what I want to do next is to create another POST request, which is hitting another REST API.

When I pass the test case .json file, which is specific to that Request in Collection Runner, all will get executed for the first request as well, as the second POST Request has a different input body, the first Request I am getting all failed.

How to create a test suite that has multiple POST Requests, and when a .json file as input is passed in the Collection Runner, only that particular Request gets executed, don't test on other Req => as it gonna fail.

n-verbitsky
  • 552
  • 2
  • 9
  • 20
HARISH
  • 169
  • 5
  • 15
  • Unfortunately, it's quite hard to understand what you're trying to do here. Probably, if you want to execute only specific requests from your collection you could suggest unchecking those tests from your execution in the Collection Runner. – n-verbitsky Jan 23 '20 at 18:47
  • Also, if you want to chain your requests you can try using postman.setNextRequest() function. Also, you can use this approach using the .json data variable. E.g. add a new 'runNextRequest' key to your .json test cases and check it in the Tests section. If it's true - run postman.setNextRequest. If false - stop the execution. – n-verbitsky Jan 23 '20 at 18:51

0 Answers0