Hi all,
I’m new to Gatling, but I took my first hurldles. But now I am facing challenges that neither the Gatling documentation nor my searches through the internet are helpful with. And my problem should be straightforward: I want to read cookies and use them in my scenario. (I expected that to be a piece of cake…) So I’m sure it is my ignorance as a newbee to Gatling. Here is my scenario.
private val scn = scenario("RAPtest")
.exec(
http("Home")
.get("/")
)
.pause(2)
.exec { session =>
session.set("sessID",getCookieValue(CookieKey("PHPSESSID")).toString)
}
.exec(
http("request_23")
.patch("/api/v1/resource/#{sessID}\"/1")
.headers(headers_23)
.body(StringBody(s"""{ "op":"replace",
"path":"/Login/#{sessID}/Login/#{sessID}}/Userid",
"value":"stefj"
} """)).asJson
.resources(
http("request_25")
.get(s"/api/v1/resource/#{sessID}/1/Login")
.headers(headers_2)
)
)
I hope it is clear what I want. After getting the home page, there is a cookie (named “PHPSESSID”), which contains the session id.
I want to store the value of that cookie in a variable, sessID, to be used in request-23. Nothing I tried has worked. The attempt shown above seems to come closest.
Request_23 fails with the following in the log:
11:42:36.301 [DEBUG] i.g.h.e.r.DefaultStatsProcessor - Request 'request_23' failed for user 1: status.find.in(200,201,202,203,204,205,206,207,208,209,304), found 500
11:42:36.303 [TRACE] i.g.h.e.r.DefaultStatsProcessor -
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
request_23: KO status.find.in(200,201,202,203,204,205,206,207,208,209,304), found 500