Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If test not passed, place its 'responseBody' at the end of output as long as condition is set #1574

Open
Alextunchii opened this Issue Jun 8, 2018 · 9 comments

Comments

@Alextunchii
Copy link

Alextunchii commented Jun 8, 2018

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

@kunagpal

This comment has been minimized.

Copy link
Member

kunagpal commented Jun 9, 2018

@Alextunchii Thanks for reporting this, I've marked it as a feature request 😄

@kunagpal kunagpal added csv and removed csv labels Jun 9, 2018

@Alextunchii

This comment has been minimized.

Copy link
Author

Alextunchii commented Jun 9, 2018

@kunagpal thank you for accepting!
Already imagined how cool it will be!🙄
Made my morning.

@shamasis shamasis added this to To do in Newman Development Progress via automation Jun 13, 2018

@shamasis

This comment has been minimized.

Copy link
Member

shamasis commented Jun 13, 2018

@kunagpal - I’ve added it to v4 triage board. Can we elaborate on the feature’s behaviour here?

@Alextunchii

This comment has been minimized.

Copy link
Author

Alextunchii commented Jun 14, 2018

@shamasis, of course, sure

@shamasis shamasis added this to the v4.0 milestone Jun 16, 2018

@connorsadlervelo

This comment has been minimized.

Copy link

connorsadlervelo commented Jun 21, 2018

I modified the reporter template to include request/response on every request - that could be an option for you?

@Alextunchii

This comment has been minimized.

Copy link
Author

Alextunchii commented Jun 21, 2018

@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

@connorsadlervelo

This comment has been minimized.

Copy link

connorsadlervelo commented Jun 22, 2018

Sounds good - where exactly do you put that code? On every request, or at folder level somewhere? Cheers

@Alextunchii

This comment has been minimized.

Copy link
Author

Alextunchii commented Jun 22, 2018

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

@Alextunchii

This comment has been minimized.

Copy link
Author

Alextunchii commented Sep 14, 2018

@kunagpal Hello!
When can we expect this nice approvement in Newman stack-trace report?

Thank you for the answer in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.