Relative Content

Tag Archive for javagatling

Gatling Java request to be called only once to retrieve login information for other requests that are executed multiple times

I want my login to be executed only once as it’s managed by a third party service, so after the token is retrieved once for the whole duration of the tests, it should not execute again. That token should be injected as a cookie header for the other api calls, not changing regardless of how many calls are done to those other requests within the same running of the tests. Below is what I have, but maybe due to the way Gatling manages sessions, it’s not working and the login is being executed as many times as the other api calls.

How to persist session between scenarios on Gatling simulation in Java

I’m trying to extract the cookie from a request and pass it into another. The login request is to be executed only once whereas the other apis may be executed multiple times. Hence the need for different scenarios. However, as gatling does not persist sessions between scenarios, I’m struggling to get the cookie from the login request into the api that uses it as header.