Complete the code to start a loop over an array of items in Postman test script.
for (let [1] = 0; [1] < items.length; [1]++) { console.log(items[[1]]); }
In Postman test scripts, the common loop variable name is i for indexing arrays.
Complete the code to loop through an array and check if each response status is 200.
pm.test('Status is 200 for item ' + [1], function () { pm.expect(responses[[1]].code).to.eql(200); });
The loop index variable i is used to identify the current item in the loop.
Fix the error in the loop that tries to iterate over an array of responses but uses wrong syntax.
for (let i = 0; i [1] responses.length; i++) { pm.expect(responses[i].code).to.eql(200); }
The loop should run while i is less than the length of the array, not less or equal.
Fill both blanks to create a loop that logs the name and status of each response in Postman.
for (let [1] = 0; [1] [2] responses.length; [1]++) { console.log(responses[[1]].name + ': ' + responses[[1]].status); }
The loop variable i is used and the condition should be i < responses.length to avoid out of range errors.
Fill all three blanks to create a loop that tests each response code and logs a pass or fail message.
for (let [1] = 0; [1] [2] responses.length; [1]++) { pm.test(`Response [3] status is 200`, function () { pm.expect(responses[[1]].code).to.eql(200); }); }
The loop variable i is used consistently, and the condition is i < responses.length.