I am using session.userId to parametrize my test requests like this:
exec(http("get request")
.get((s:Session) => "somebaseUrl/" + s.userId.toString ))
Is it possible to get sesion userId differently, so my request addresses are more DRY, eg I won't have to use lambda?
I tried using gatling DSL:
exec(http("get request")
.get("somebaseUrl/${userId}")
but then I get: No attribute named 'userId' is defined
error
I could just calculate some random id to my tests, but why when gatling already does this.
Only solution that I came up with is saving userId to some different attribute like this:
exec((s:Session) => s.set("user_id",s.userId)),
exec(http("test").get("${user_id}"))
but that doesn't seem right, and you have to make sure to call the set before all other requests.