Request and Response Logging In Rest Assured Framework - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Sunday 16 June 2019

Request and Response Logging In Rest Assured Framework

Rest Assured provides us the capability to Log the Request and Response of the APIs before sending to server.

Below are the functions we can use for Logging

log().all(). .. ..// This Log all request details including parameters, headers and body
log().params(). .... // This will log only the parameters of the request
log().body(). .. // This will log only the request body
log().headers(). .. // This will log only the request headers
log().cookies(). .. // This will log only the request cookies
log().method(). .. // This will log only the request method
log().path(). .. // This will log only the request path

Request Logging

Using log.path






Response Logging

We can use log.body or log.all for Response Logging

log.body will log only Body

log.all will log everything

Example of log().body().

Response Body



Example of log().all().

Response Body


No comments:

Post a Comment