0
0
Postmantesting~5 mins

Output block in Postman - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ATo write assertions and show test results
BTo send HTTP requests
CTo create new APIs
DTo store environment variables
Which function is used to define a test inside the Output block?
Apm.sendRequest()
Bpm.test()
Cpm.response()
Dpm.expect()
What does pm.expect(pm.response.code).to.equal(200) check?
AResponse time is 200ms
BResponse body length is 200
CResponse header count is 200
DResponse status code is 200
Where can you see messages printed by console.log() in Postman?
AIn the Postman Console
BIn the response body
CIn the environment variables
DIn the request URL
Why should test messages be clear and descriptive?
ATo confuse the tester
BTo make tests run faster
CTo easily understand test results
DTo reduce the number of tests
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.