By default Rest-Assured is printing too much debug data to the console.
Can anyone tell how can I disable it?
By default Rest-Assured is printing too much debug data to the console.
Can anyone tell how can I disable it?
You can tell RestAssured what you want to log like this:
RestAssured
.given()
.log().ifValidationFails(LogDetail.ALL, true)
.body(body)
.post("URL")
.then()
.log().ifValidationFails(LogDetail.ALL, true)
.extract()
.jsonPath()
.getObject("body", DTO.class)
and if something go wrong it print request/response info to console.
You can choose which part of request/response to log by specify value from io.restassured.filter.log.LogDetail as ifValidationFails() first param.
If you want log request or response all the time use this
RestAssured
.given()
.log().<all|body|headers|etc>()
.body(body)
.post("URL")
.then()
.log().<all|body|headers|etc>()
.extract()
.jsonPath()
.getObject("body", DTO.class)
log() after given() will config request logging
log() after then() will config response logging
You can find more helpful info here https://github.com/rest-assured/rest-assured/wiki/Usage#logging
remove line from RestAssured
RestAssured.baseURI = "http://" + System.getProperty("API_HOST");
RestAssured.port = Integer.parseInt(System.getProperty("API_PORT", "8080"));
or use
System.setProperty("http.maxConnections","100");
config = config().httpClient(httpClientConfig().reuseHttpClientInstance().httpClientFactory(
() -> new SystemDefaultHttpClient()
));