Which of the following alert conditions in Postman Monitors will trigger an alert only when the response time exceeds 2000 milliseconds?
Think about the condition that strictly checks if response time is more than 2000 ms.
The condition responseTime > 2000 triggers alerts only when the response time is strictly greater than 2000 milliseconds. Using >= would also trigger when response time equals 2000 ms, which is not asked.
What will be the output of the following Postman test script if the response status code is 404?
if (pm.response.code !== 200) { pm.alerts.trigger('Status code is not OK'); } else { pm.alerts.clear(); } pm.test('Check alert triggered', () => { pm.expect(pm.alerts.hasAlerts()).to.be.true; });
Check what happens when status code is not 200.
The script triggers an alert when the status code is not 200. Since the response code is 404, the alert triggers and pm.alerts.hasAlerts() returns true, so the test passes.
Which assertion correctly verifies that the alert message contains the word 'timeout' in Postman test scripts?
const alertMessages = pm.alerts.getAll().map(alert => alert.message);Remember that alertMessages is an array of strings.
Option D uses some() with includes() to check if any alert message contains 'timeout'. Other options use invalid or incorrect methods for arrays.
A Postman monitor alert is not triggering even though the response time exceeds the threshold. Which is the most likely cause?
Check the alert condition logic carefully.
If the alert condition checks for responseTime less than 2000 ms, it will never trigger when response time is higher. This is the most common logical error causing alerts not to trigger.
When configuring multiple alerts for different failure conditions in a Postman monitor, which approach ensures clear and maintainable alert management?
Think about clarity and traceability of alerts.
Using separate pm.alerts.trigger() calls with clear messages for each failure condition helps identify exactly what failed. This improves maintainability and debugging.