I guess I was not clear early. Let me re-pharse
Currently my framework everywhere uses given().spec(requestSpec).expect().spec(responseSpec).get(relUrl);
ResponseSpecBuilder responseSpecBuilder= new ResponseSpecBuilder();
ResponseSpecification respSpec = responseSpecBuilder.expectBody(anything()).build()
Request is sent in one Step and Response Validfation is done in another Step
Request is sent using the follolwing
given().spec(requestSpec).expect().spec(responseSpec).get(relUrl);
Respone validation is done by the following in another step
ResponseSpecBuilder builder =new ResponseSpecBuilder();
builder
.expectBody("email", equalTo("someEmail"))
.expectBody("title", equalTo("Some Title"));
/// Validate Response
builder.build().validate(getScenario().getResponse());
In above Scenario When Validation is not done on given... statement as ResponsSpec expects anything(or response validation is not done)
the statement given.log().ifValidationFails().when().get("/x") does not log when Validation Fails, It logs irrespective of validation, as Validation is never
done in given statement
So, In a nut shull, when you use given().log().ifValidationFails().spec(requestSpec).expect().spec(responseSpec)
log().ifValidationFails() is not effective as the logging is always done irrespective of result, and may be also because validation is done
in builder.build().validate(getScenario().getResponse());