Hi,
I am looking for a way to do the following in gatling.
Send a login request once per user, extract the cookie
Send a series of subsequent requests for a specific duration using the cookie of the user.
I have done the cookie extraction and use it in subsequent requests, i am looking for a way to send the first request only once per user and the remaining requests for the entire duration.
I can do this using only-once controller in jmeter quite easily. How do I simulate the same with gatling ?
First of all, are you sure you need to extract the cookie yourself? Gatling cookie support is enabled by default, so you only have to manipulate cookies yourself if you want to reproduce some javascript logic.
As Nicolas suggested:
exec(http(“first request”))
.during(the duration you want) {
// the requests you want to loop on
}
I should have been clear. It is not technically a cookie. In my case the cookie that I refer is a long session id that comes with the response itself. I have extracted that using regex and saveAs.
I did try duration and and the same way as mentioned by Nicolos.
Thanks Stephane. I have been trying with and without dots for sometime.
This is my new code. With this, only the first request is running and the chain inside duration() did not run. I might be doing something really elementary, just not able to pick where.