timeoutpollinggatling

Manually timing out a request in Gatling


I have a long-poll method in my application that will return a response either when a certain operation is completed (returns info about the op) or when it times out (configured server-side timeout).

I need to test it in Gatling in a way that while Gatling is waiting for the response, I can specify a timeout for the request so it will fail after that time passes if the request hasn't returned a response on its own.

E.g. the long poll's server-side timeout is 20 seconds and I want Gatling to stop waiting for the response and render the request as failed if 15 seconds have passed.

Is it at all possible? Thank you


Solution

  • After a lot of research and waiting for help from the community, I came up with my own solution.

    I decided to rely on Gatling's HTTP request timeout (default 60 seconds). I even have two options, depending on the environment:

    1) Leave the server long poll timeout configuration be (20 seconds) and configure the Gatling's timeout accordingly (e.g. 15 seconds). Other tests and requests will not be influenced by it in a fast testing environment.

    2) Leave the Gatling's timeout be (60 seconds) and increase the server's long poll timeout configuration (e.g. 70 seconds). Then the other requests and tests will not be influenced in any environment.