Recall & Review
beginner
What is an Output block in Postman tests?
An Output block in Postman is a section in the test script where you write code to check the response and print results or messages. It helps you see if your test passed or failed.
Click to reveal answer
beginner
How do you write an assertion inside an Output block in Postman?
You use the pm.test() function with a description and a function that contains pm.expect() to check values. For example: pm.test('Status is 200', () => { pm.response.to.have.status(200); });
Click to reveal answer
beginner
Why is it important to use clear messages in Output blocks?
Clear messages help you understand what each test checks and if it passed or failed. It’s like reading a clear label on a box to know what’s inside.
Click to reveal answer
beginner
What does pm.response.to.have.status(200) check in an Output block?
It checks if the response from the server has a status code of 200, which means the request was successful.
Click to reveal answer
beginner
How can you print custom messages in the Output block for debugging?
You can use console.log('Your message') inside the test script to print messages in Postman’s console for easier debugging.
Click to reveal answer
What is the main purpose of the Output block in Postman tests?
✗ Incorrect
The Output block is where you write assertions to check responses and display test results.
Which function is used to define a test inside the Output block?
✗ Incorrect
pm.test() defines a test with a name and a function containing assertions.
What does pm.expect(pm.response.code).to.equal(200) check?
✗ Incorrect
It checks that the HTTP response status code equals 200, meaning success.
Where can you see messages printed by console.log() in Postman?
✗ Incorrect
console.log() messages appear in the Postman Console for debugging.
Why should test messages be clear and descriptive?
✗ Incorrect
Clear messages help testers quickly understand what each test checks and its result.
Explain what an Output block is in Postman and how it helps in testing.
Think about where you write checks and see if your API works as expected.
You got /3 concepts.
Describe how to write a simple test in the Output block to check if the response status is 200.
Start with pm.test and inside use pm.expect to check the status.
You got /3 concepts.