Complete the code to set the number of iterations for a Postman load test.
pm.environment.set('iterations', [1]);
The number of iterations must be a numeric value like 100 to run the load test multiple times.
Complete the code to check if the response status code is 200 in a Postman test script.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
The status code 200 means the request was successful. It should be a number, not a string.
Fix the error in the Postman test script to correctly check if response time is less than 500ms.
pm.test('Response time is less than 500ms', function () { pm.expect(pm.response.responseTime [1] 500).to.be.true(); });
The operator '<' checks if the response time is less than 500 milliseconds.
Fill both blanks to create a Postman test that checks if the response body contains the word 'success' and the status code is 200.
pm.test('Body contains success and status is 200', function () { pm.expect(pm.response.text()).[1]('success'); pm.response.to.have.status([2]); });
'includes' checks if the response text contains 'success'. The status code 200 means OK.
Fill all three blanks to create a Postman test that checks if the JSON response has a 'status' key equal to 'ok', and the response time is less than 300ms.
pm.test('Status is ok and response time is fast', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.eql([2]); pm.expect(pm.response.responseTime [3] 300).to.be.true(); });
We check the 'status' key in JSON equals 'ok' (string), and response time is less than 300ms.