How can I view responses in Postman Collection Runner? - postman

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?

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.
More information can be going on the Debugging using the Request & Response body section of this page

This might help somebody, I tried
pm.test(responseBody, true)
and this printed the response in run summary.

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
and export it as json (on the interface you only see the zero/one results if test passed or not).
It's not very useful but this is the only way I've found.

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 ;)

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

Related

Is it possible to POST parameters when running the "Collection runner" in POSTMAN

Problem is that I'm trying to change the settings of the website with POST and would like to confirm that the settings changed with a new GET request after the change, but as I'm running the collection it's just running the tests but not the POST itself, POST does not have any response so there's nothing to check there.
I hope that I was clear enough explaining my problem.
Thanks Guys!
If I'm understanding this correctly:
You have two requests and want to run the GET immediately after the POST. This can simply be done by using environment variables and SetNextRequest.
Be careful of entering an infinite loop because Collections run top down; if your GET request was before the POST request. It may be better to duplicate your GET request and place it below the POST.
A Post to {{base_url}}/website
Within the Pre-request Script set your new settings to your environment
pm.environment.set("setting1", "newValue");
Within the Body if your sending raw json for example use that variable
{
"setting1": "{{setting1}}"
}
Postman still runs the Test section you don't need a pm.test it's essentially a Post-request Script. Tell Postman to run the GET request next:
postman.setNextRequest("Get Website Settings");
From your Get request within Tests section validate the setting is correct
pm.test("Setting has been updated to" + {setting1}, function() {
var actualSetting = pm.response.json().setting1;
pm.expect(actualSetting).is.eql({setting1});
});

setNextRequest() in Postman

I am trying to set a request after a certain request in postman, but It is not working as I want it to be. I have read through Postman documentation but got no luck. Plus, how do I get postman's request ID?
I am using the given JavaScript in the Test tab, and in postman documentation it says it should work. But no luck.
postman.setNextRequest('Login');
postman.setNextRequest('Login') will work only inside the Runner. Also, the requests need to be in the same Collection.
Even if the request is in another folder (while still in the same collection), you can reference it in setNextRequest(), without having to specify any folder.
And to answer your second question, "how to get the Postman Request Id?"
Use this pm.info.requestId which will return string value, you may set that in environment variable as well, like pm.environment.set("rID", pm.info.requestId)

How to access the true RAW request body from post man on a pre-request script?

I'm trying to authenticate myself against an API. This API uses the raw body from the request to create the hash that it will use to authenticate against my token.
For testing purposes, I'm using postman with a pre request script to create the hash. Everything works fine, with one exception:
In the code tab I have this
however if on the pre request script I dump the value of the request body I get by using request.data I obtain
The problem is, its not exactly the same string, then the value retrieved by request.data creates a hash with a different body that the server uses to create its hash (the server uses the one beautified with line endings and tabs). This is the script where I use the request body content:
So unless someone have an idea of how to retrieve the json body exactly on the format it was written, pretty much seems I cant use postman for this
thanks!
EDIT: I don't know if this existed 5 years ago when the original Question was posted, but it's available in PostMan 8.12.2 at least.
When you have a request open in Postman, show the "Code" pane at the right by clicking the </> button seen in the right-hand toolbar.
Then in the dropdown header for code type, choose "HTTP".
The line numbers in the HTTP snippet are significant -- in my screenshot, the last four displayed lines are concatenated into line 6 of the actual HTTP.
just changed the post body tab to
new post body
and it went just fine. Not really the best solution i was expecting, but does the job :)

Jmeter 406 error - token not found

I'm using Jmeter for the first time to test the Load from a website. But there are exactly 3 API's that don't seem to work. The three of them have the same error page at the View Results Tree (I translated the error message to english):
The Test Plan already has the HTTP Request Defaults, HTTP Cookie Manager, HTTP Header Manager and Recording Controller.
How can I solve that problem or know which is the Token that is missing? Some API's that come after it have a Cookie Data called .ASPXAUTH. Is that the token I need?
It is quite hard to guess without seeing your request and response details, you can identify the required dynamic parameter (token or whatever) by recording your test one more time and compare resulting .jmx files for differences.
Carefully inspect everything as the token might come as a Cookie, as a Header, as a part of the response URL after redirection or in the response body and use the relevant JMeter's Post-Processor to extract it from the previous response and add to the next request.
The process is known as correlation and you should be able to find a plenty of information on different approaches over the web via jmeter correlation query in your favorite search engine.
You may also be interested in an alternative way of recording a JMeter test which automatically detects and works around dynamic parameters so you won't have to do this manually, check out How to Cut Your JMeter Scripting Time by 80% article for more details.

Postman inconsistent behaviour with cURL request

I have the following API downloaded in JSON from Swagger Editor:
PUT http://10.37.64.243/m2m/fim/items/fim:device:manager/operations/getAllDeviceTypes?exclude={{exclude}}
with exclude being an environment variable set as : href,metadata,name,arguments
Nominal use requires basic authentication, in this case it works and I get a JSON body with expected result. It properly works in Postman (so I think my import is correct)
If no authentication is provided:
in Swagger Editor : nominal behaviour, request is rejected with error code 401
in Postman : UNEXPECTED behaviour, I end up with status code 200 and it returns a response body identical to the one that I get when authenticated
if I generate the cURL code snippet from Postman and launch it out of Postman: nominal behaviour, I get the same error as the one I get in Swagger Editor (the one expected)
Why do Postman behave differently from the cURL request ??
I probably do something wrong, but I can't figure out what
Thanks for any help
Alexandre
I finally found out that the server returns a cookie that holds authentication validation. So after a valid authentication, whatever the request (with or without authentication) it will be considered as authentified.
Unfortunately, the only way to overcome that problem is to remove the cookie by hand through the "Manage cookies" window. Postman does not implement a function that erase it (even through the pm.cookies and pm.cookies.clear() function).
Postman developpers are aware of that, but there's no scheduling for this feature ...
EDIT: the feature is followed here https://github.com/postmanlabs/postman-app-support/issues/3312