)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\nRestAssured.given() method is used to set up the preconditions for the request. Here we are providing the base URL using the base URI() method.<\/p>\n\n\n\n
When() is used to specify the action to be performed, it shows that a GET request will be made to resource ‘\/endpoint’.<\/p>\n\n\n\n
then() It is used to perform assertions or validations on the response.<\/p>\n\n\n\n
statusCode() is the verification point to assert whether the condition was successfully met or not.<\/p>\n\n\n\n
<\/span>6) How to log response in Rest Assured only in the case of an error.<\/strong><\/span><\/h3>\n\n\n\nUser ifError()<\/strong> method. It Logs everything only if an error occurs.<\/p>\n\n\n\n