Log if validation fails api

Code examples

0
0

log if validation fails api

Log if validation fails
Since REST Assured 2.3.1 you can log the
request or response only if the validation fails.
To log the request do:

given().log().ifValidationFails(). ..
To log the response do:

.. .then().log().ifValidationFails(). ..
It's also possible to enable this for both
the request and the response at the same time using the LogConfig:

given().config(RestAssured.config().
logConfig(logConfig().enableLoggingO
fRequestAndResponseIfValidationFails(HEADERS))). ..
This will log only the headers if validation fails.

There's also a shortcut for enabling logging
of the request and response for all requests if validation fails:

RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Íslensk
..................................................................................................................