For our application, we are supposed to write the test scripts which test our REST API.
So I have written individual tests in postman in a collection. When ran individually, all tests pass.
Now to run all tests sequentially in a collection, I want the output of the first GET request (the response is an array of JSON objects), to pass as input body to next POST request.
The following code is written as a test in Tests of GET request.
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("data", jsonData);
postman.setNextRequest("POST request");
I have named my post request as "POST request". But this test is failing.
Please let me know if I have done any mistakes.