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
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().
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