Hi,
We have a scenario in which the user performs to consecutive requests, which will be like this is pseoducode:
- http(POST): /createUserSession /* returns a userSessionId */
- http(POST): /ceateShoppingCart
.queryParam(“sid”,userSessionId) /* create a shoppingCart using the userSessionId)
I tried to store the userSessionId as session variable in the first request, and then pass it as a parameter in the second request:
val search =
exec(http(“getuserSessionID”)
.post("/session/create")
.exec(session => {session.set(“session_id”, ((parse(userSessionId…)) /* catching the userSessionId in the first request */
session})
.exec(http(“createShoppingCart”)
.post("/cart/")
.queryParam(“sid”,session(“userSessionId”).as[String] ) /* passing the stored userSessionId in the second request */
However the second request fails as the passed userSessionId is always null, as if it is working with a new session who does not have the userSessionId.
In gatling, is a SESSION created for each USER, or each REQUEST? Does the second request create a new session?
How can I share session variables between consecutive requests of a single user?
Would highly appreciate any help!
Regards,
Srinivas