Hi. I successfully use newman for testing API. Our tests are placed on ES2 server in TeamCity CI.
We have more than 200 requests.
For each request added responseCode check and condition, for instance:
if(responseCode.code !== 200)
{
console.log(responseJSON);
return;
}
And when 500 returned, response revealed in build.log directly where this request is placed in the order of all requests blanket, and to see quickly info what happened devs need to scroll and search where exactly this request to see an error log in response json.
Could we place this somehow at the end where located the result table, below with failed asserts?
It could be great to see error information quickly
@Alextunchii Thanks for reporting this, I've marked it as a feature request 馃槃
@kunagpal thank you for accepting!
Already imagined how cool it will be!馃檮
Made my morning.
@kunagpal - I鈥檝e added it to v4 triage board. Can we elaborate on the feature鈥檚 behaviour here?
@shamasis, of course, sure
I modified the reporter template to include request/response on every request - that could be an option for you?
@connorsadlervelo thanks! But if get you right, just to know:
I and everybody don't need request/response on every request. It can be done simply with
var body = JSON.parse(responseBody)
console.log(body);
All I need it's to have response output on the bottom of build.log and in order not to search the resposne body of the failed request in long long stack race
Sounds good - where exactly do you put that code? On every request, or at folder level somewhere? Cheers
It depends of folder and collection;
If in folder every request has response code 200
then I put it on Folder level:
var jsonData = JSON.parse(responseBody);
tests["Status code is 200"] = responseCode.code === 200;
if (responseCode.code !== 200) {
console.log(jsonData);
}
and then you see the response body in build log if (for instance) 500 server error occurred
@kunagpal Hello!
When can we expect this nice approvement in Newman stack-trace report?
Thank you for the answer in advance!
Most helpful comment
@kunagpal Hello!
When can we expect this nice approvement in Newman stack-trace report?
Thank you for the answer in advance!