status has the value success?pm.test('Status is success', function () {
// Write assertion here
});Option A uses to.eql() which checks deep equality and matches the string 'success'. Other options either use wrong assertion methods or compare to wrong types.
items which is an array with at least one element?pm.test('Items array is not empty', function () {
// Write assertion here
});Option A correctly asserts that items is an array and is not empty using Chai's BDD style. Other options have syntax errors or incorrect chaining.
{"user":{"id":123,"active":true}}?pm.test('User is active', function () {
pm.expect(pm.response.json().user.active).to.be.false;
});active key and the assertion used.The assertion expects active to be false but the response has it as true, so the test fails with an assertion error.
{"data":{"count":5}}?
pm.test('Count is 5', function () {
pm.expect(pm.response.json().count).to.eql(5);
});The script tries to access count at the root level but it is inside the data object, so pm.response.json().count is undefined causing the assertion to fail.
message in the response body is either absent or a non-empty string if present?Option C is best practice because it handles both cases gracefully: if the key exists, it validates the value; if not, it does not fail the test unnecessarily.
