Complete the code to send a GET request to check API status.
pm.sendRequest({ url: '[1]', method: 'GET' }, function (err, res) { pm.expect(res).to.have.status(200); });The full URL with protocol is required to send a proper GET request in Postman scripts.
Complete the code to check if the API response time is less than 200ms.
pm.test('Response time is acceptable', function () { pm.expect(pm.response.responseTime).to.be.[1](200); });
We want to ensure the response time is below 200 milliseconds for good API health.
Fix the error in the test that checks if the response body contains the key 'status'.
pm.test('Response has status key', function () { pm.expect(pm.response.json()).to.have.[1]('status'); });
The correct Chai assertion to check for an object key is 'property'.
Fill both blanks to create a test that checks if the API response status is 200 and the response time is less than 300ms.
pm.test('API health check', function () { pm.expect(pm.response).to.have.status([1]); pm.expect(pm.response.responseTime).to.be.[2](300); });
Status code 200 means success, and response time below 300ms means good performance.
Fill all three blanks to write a test that verifies the response JSON has a 'status' key with value 'ok' and response time less than 250ms.
pm.test('Complete API health check', function () { const jsonData = pm.response.json(); pm.expect(jsonData).to.have.[1]('status'); pm.expect(jsonData.status).to.eql([2]); pm.expect(pm.response.responseTime).to.be.[3](250); });
Check the JSON has 'status' key, its value equals 'ok' (case sensitive), and response time is below 250ms.