Logging entire json response

Hi,

I would like to log entire json response in simulation.log - how can I do that?

I can see responses in Recorder but after I quit it this information is lost (it does not seem to dump it into recorder.log ? - I did not find ) and also it looks to me that in my case the text box only displays part of the response not the entire json (possibly limitation of the textbox).

It is actually very useful to have raw recording of requests / responses for the future references next to recorded simulation - I found this was a helpful feature in LR - maybe this can be an enhancement request?

If I do not have that info in hand - how can I implement checks/ data extraction at a latter stage? I have to record again every time I want to enhance the script.

People please could you share your best practices?

Many thanks,
Natalie

Hi,

I would like to log entire json response in simulation.log - how can I do
that?

You can use an extractor (refactored in Gatling 2) and dump response body
string:
https://github.com/excilys/gatling/wiki/HTTP#wiki-custom-dump
https://github.com/excilys/gatling/wiki/Gatling-2#wiki-http-misc

Note that simulation.log is a tsv file, so beware of eol and tabs that you
might have to escape/remove.

I can see responses in Recorder but after I quit it this information is
lost (it does not seem to dump it into recorder.log ? - I did not find )
and also it looks to me that in my case the text box only displays part of
the response not the entire json (possibly limitation of the textbox).

It is actually very useful to have raw recording of requests / responses
for the future references next to recorded simulation - I found this was a
helpful feature in LR - maybe this can be an enhancement request?

We'll have a debug mode that will log everything and display it in another
set of reports where you'll get a waterfall of each user activity:
https://github.com/excilys/gatling/issues/1177

If I do not have that info in hand - how can I implement checks/ data
extraction at a latter stage? I have to record again every time I want to
enhance the script.

Sorry, I don't understand why you have to re-record.

People please could you share your best practices?

I personally extract common/reusable scenario parts into objects.

Thanks Stéphane,

would you be so kind to provide an example of how to use extraInfoExtractor so that it logs json request and response bodies in simulation.log in Gatling 2?

Many thanks,
Natalie

extraInfoExtractor is for dumping additional data in the simulation.log file.And here, you’re returning nothing (an empty List), so of course it doesn’t dump anything.

Beware that Gatling discards chunks if possible, see https://github.com/excilys/gatling/wiki/HTTP#chunks-discarding