Complete the code to check if the monitor run was successful.
pm.test('Monitor run status is successful', function () { pm.expect(pm.response.code).to.equal([1]); });
The HTTP status code 200 means the request was successful, so the test checks for this code.
Complete the code to assert the response time is less than 500 milliseconds.
pm.test('Response time is acceptable', function () { pm.expect(pm.response.responseTime).to.be.[1](500); });
above or greaterThan which check the opposite.below which is not a valid Chai assertion method.The method lessThan checks if the response time is less than the given value.
Fix the error in the assertion to check if the JSON response has a 'success' property set to true.
pm.test('Response has success property true', function () { pm.expect(pm.response.json().[1]).to.eql(true); });
The JSON response should have a property named success that is true for this test.
Fill both blanks to create a test that checks if the response body contains the word 'monitor' and the status code is 200.
pm.test('Response contains monitor and status is 200', function () { pm.expect(pm.response.text().[1]('monitor')).to.be.[2]; pm.expect(pm.response.code).to.equal(200); });
indexOf without comparing to -1.false instead of true.The includes method returns true if the string contains the substring. The test expects this to be true.
Fill all three blanks to write a test that checks if the JSON response has a 'data' object, the 'id' inside 'data' is greater than 0, and the status code is 200.
pm.test('Data object and valid id present', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.be.an('object'); pm.expect(jsonData.data.[2]).to.be.[3](0); pm.expect(pm.response.code).to.equal(200); });
The test checks that jsonData.data is an object, jsonData.data.id is greater than 0 using above, and the status code is 200.