If the actual response time is 350ms, what will be the test result?
medium
A. Test will pass because 350 is below 300
B. Test will be skipped automatically
C. Test will error due to syntax mistake
D. Test will fail because 350 is not below 300
Solution
Step 1: Understand the assertion condition
The test expects response time to be below 300ms.
Step 2: Compare actual response time with condition
Actual response time is 350ms, which is greater than 300ms, so the condition fails.
Final Answer:
Test will fail because 350 is not below 300 -> Option D
Quick Check:
350 > 300 means test fails [OK]
Hint: Compare actual value with assertion condition carefully [OK]
Common Mistakes:
Assuming test passes if value is greater
Confusing below with above
Thinking syntax error causes failure
4. You wrote this Postman test:
pm.test('Response time test', () => {
pm.expect(pm.response.responseTime).to.be.lessThan(400);
});
But the test always errors out. What is the likely problem?
medium
A. You should use pm.response.time instead of pm.response.responseTime
B. The method lessThan is not valid in Postman assertions
C. The test needs to be inside a pm.response.to block
D. The response time cannot be tested in Postman
Solution
Step 1: Check Postman assertion methods
Postman uses Chai assertion library where the correct method is below, not lessThan.
Step 2: Identify the invalid method causing error
Using lessThan causes a syntax error because it is not recognized.
Final Answer:
The method lessThan is not valid in Postman assertions -> Option B
Quick Check:
Use .to.be.below() not .lessThan() [OK]
Hint: Use .to.be.below() for less than, not .lessThan() [OK]
Common Mistakes:
Using unsupported assertion methods
Confusing property names for response time
Thinking response time tests are unsupported
5. You want to fail a Postman test if the response time is more than 200ms but allow up to 300ms with a warning message. Which test script correctly implements this?
hard
A. pm.test('Response time check', () => {
if(pm.response.responseTime > 300) {
pm.expect.fail('Response time too high');
} else if(pm.response.responseTime > 200) {
console.warn('Warning: Response time above 200ms');
} else {
pm.expect(pm.response.responseTime).to.be.below(201);
}
});
B. pm.test('Response time check', () => {
pm.expect(pm.response.responseTime).to.be.below(200);
if(pm.response.responseTime > 300) {
console.warn('Warning: Response time above 300ms');
}
});
C. pm.test('Response time check', () => {
if(pm.response.responseTime > 200) {
pm.expect.fail('Response time too high');
} else {
pm.expect(pm.response.responseTime).to.be.below(300);
}
});
D. pm.test('Response time check', () => {
pm.expect(pm.response.responseTime).to.be.below(300);
if(pm.response.responseTime > 200) {
pm.expect.fail('Response time warning');
}
});
Solution
Step 1: Understand the requirement
Fail test if response time > 300ms, warn if > 200ms but ≤ 300ms, pass otherwise.
Step 2: Analyze each option logic
pm.test('Response time check', () => {
if(pm.response.responseTime > 300) {
pm.expect.fail('Response time too high');
} else if(pm.response.responseTime > 200) {
console.warn('Warning: Response time above 200ms');
} else {
pm.expect(pm.response.responseTime).to.be.below(201);
}
}); correctly fails if > 300, warns if between 201 and 300, and passes if ≤ 200. Others either fail incorrectly or misuse warnings.
Final Answer:
pm.test('Response time check', () => { if(pm.response.responseTime > 300) { pm.expect.fail('Response time too high'); } else if(pm.response.responseTime > 200) { console.warn('Warning: Response time above 200ms'); } else { pm.expect(pm.response.responseTime).to.be.below(201); } }); -> Option A
Quick Check:
Fail above 300, warn above 200, else pass [OK]
Hint: Use if-else to separate fail, warn, and pass conditions [OK]
Common Mistakes:
Failing test on warning condition
Using console.warn without fail for errors
Incorrect order of conditions causing wrong results
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.