Introduction
To print the response and/or
request details in order to help us create the correct expectations and send
the correct requests. RestAssured has provided us with Pre-defined filter.
Request Logging
REST Assured supports
logging the request
specification before it's sent to the server using the RequestLoggingFilter.
For e.g, if we wanted to see
complete response what is being sent to the server we can simply add log().all() in
request header
Request Logging |
Request Output |
Please Note the above output might be changed based
on the parameter you sent with JSON request. In a similar way we can specify any
other parameter in the log as per requirement.
Response Logging
In the Similar way as Request logging if we
want to print the response body regardless of the status code we can do so by
then().log().body();
for logging the complete body request we can
again use log().all() and the response would be like this.
Response Logging |
Response Output |
Hi Ankur, Great Post :)
Reply