0

This code is not working as expected when running collection and used as a test script on the first request:

  1. when console.log gives output null, the collection doesn't stop, when it should.

  2. function never goes to the 'else' condition, even when I force it by changing the GET results.

     pm.test("Any?", function () {
     var jsonData = pm.response.json();
     if (pm.expect(jsonData.metadata.total_data).to.eql(0))
     {console.log('null');
     postman.setNextRequest(null);}
     else
     {console.log('Next request');
     postman.setNextRequest('Name of Next request');}
     });
    

1 Answers1

0

Use a forEach and store the jsonData you want to check in a data array.

let checkingValues= [4,1,5,6,2];
checkingValues.forEach(() => {