How can I view responses in Postman Collection Runner?
Asked Answered
L

6

26

I am using the Postman Collection Runner to run the same request multiple times using iterations. My tests work as expected, but I'm not able to see the individual responses for each request.

Is it possible to view the responses for requests in the Postman Collection Runner?

Level answered 7/9, 2016 at 13:36 Comment(0)
I
31

This might help somebody, I tried

pm.test(responseBody, true)

and this printed the response in run summary.

Igbo answered 2/2, 2018 at 18:44 Comment(2)
Looks good! Do you have hint how to print out also the requestBody? pm.test(requestBody, true) is not working :-)Savor
Hi @Dafka, To print request, you can use the request object like this, pm.test(request.url, true); pm.test(request.body, true); pm.test(request.header, true); You can find more about the request object @ postmanlabs.com/postman-collection/Request.html#~definition Hope this would help. Thanks.Igbo
B
39

In the latest version of Postman you can see all the data from the collection run for each individual request.

In the Collection Runner, Click on the request name and all the details of the request and response can be viewed.

enter image description here

More information can be going on the Debugging using the Request & Response body section of this page

Bretbretagne answered 26/12, 2017 at 22:34 Comment(5)
Is there anyway to include those in the exported results?Cucullate
Not in the UI export I don’t think, possibly running the collection through a Newman script? It’s not something I do so I would need to try it out. :)Bretbretagne
Thanks Danny. I tried newman, but it's hard to know what data is available to the export template.Cucullate
When I try this I get a message saying "Data unavailable (only data about the top 10 historical runs is stored). The solution is to click the 'New' button at top right and re run the collection.Etheridge
I believe that there is an open issue around this problem and will be addressed in future releases.Bretbretagne
I
31

This might help somebody, I tried

pm.test(responseBody, true)

and this printed the response in run summary.

Igbo answered 2/2, 2018 at 18:44 Comment(2)
Looks good! Do you have hint how to print out also the requestBody? pm.test(requestBody, true) is not working :-)Savor
Hi @Dafka, To print request, you can use the request object like this, pm.test(request.url, true); pm.test(request.body, true); pm.test(request.header, true); You can find more about the request object @ postmanlabs.com/postman-collection/Request.html#~definition Hope this would help. Thanks.Igbo
L
5

Let me add more details about the shadowcharly solution.

Your results may be viewed if you assign responseBody variable to tests array (in Tests tab)

tests["body"] = responseBody

enter image description here

and export it as json (on the interface you only see the zero/one results if test passed or not).

enter image description here

enter image description here

enter image description here

It's not very useful but this is the only way I've found.

Loess answered 1/2, 2017 at 17:45 Comment(1)
The given statement for test, returns a { "name": "body", "status": "pass" }, in my output. Can you please suggest what can I do?Comet
F
1

If you are repeating exactly the same query, you could use the test name to show the result:

tests['Test to see value of key Key'+ keyValue] = testResult....

You will have a different test for each value received, not exactly a log, but works fantastic ;)

Feat answered 13/10, 2016 at 13:48 Comment(0)
S
1

I know this is old, but postman has added a feature in the collection runner. enter image description here

Sinless answered 4/8, 2020 at 22:2 Comment(2)
Its not saving the responses for me. Any idea what could be problemPredator
@Predator Same hereIncept
F
0

In my postman(Version 10.15.4) I can simply choose Persist responses for a session option on Collection Runner UI.

After that, you can click each test case and see the response body. Please refer to the attachment screenshots. enter image description here

Fellah answered 14/7, 2023 at 1:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.