Complete the code to set the alert condition to trigger when the response status code is 404.
pm.test('Status code is 404', function () { pm.response.to.have.status([1]); });
The alert triggers when the response status code matches 404, indicating 'Not Found'.
Complete the code to check if the response time is less than 200 milliseconds.
pm.test('Response time is fast', function () { pm.expect(pm.response.responseTime).to.be.[1](200); });
The method lessThan checks if the response time is less than the given value.
Fix the error in the code to correctly check if the JSON response has a property 'success' set to true.
pm.test('Response has success true', function () { pm.expect(pm.response.json().[1]).to.eql(true); });
Access the property directly with success to compare its value to true.
Fill both blanks to create an alert that checks if the response body contains the string 'error' and the status code is 500.
pm.test('Error response check', function () { pm.expect(pm.response.text().[1]('error')).to.be.[2]; pm.response.to.have.status(500); });
The includes method returns true if 'error' is found in the response text, which we assert to be true.
Fill all three blanks to create a test that verifies the response JSON has a property 'data' which is an array with length greater than 0.
pm.test('Data array is not empty', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.be.an('[2]').and.to.have.length.[3](0); });
Access the 'data' property, check it is an array, and assert its length is above 0.