Mano Kugan
Mano Kugan

Reputation: 219

How to add wait-time to complete a request and get the response in Rest-Assured

I am trying to do an upload via api, when the data is small eg:100 rows the upload works fine and I get the response as expected but when the upload is large, eg:1M rows, the test fails with Time-out-exception. How can I handle this? Is Thread.sleep() a recommended method?

Upvotes: 0

Views: 3337

Answers (1)

Arun Nair
Arun Nair

Reputation: 478

You can use like this. if it is not working, please provide code.

RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(5000)
                .setSocketTimeout(5000).build();

        HttpClientConfig httpClientFactory = HttpClientConfig.httpClientConfig()
                .httpClientFactory(() -> HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build());

        RestAssured.config = RestAssured.config().httpClient(httpClientFactory);

Upvotes: 2

Related Questions