Session.set doesn't work?


I’m using Gatling 2.0.0 SNAPSHOT, i tried to set session as below:

.exec(session => {
session.set(“myValue”, “1234”)
.exec(session =>{


But it throws exception:
“…akka://GatlingSystem/user/$g] key not found: myValue”

How can I resolve this?

Thanks in advance.

I removed session in the first exec and it works now.
exec(session => {
session.set(“myValue”, “1234”)

And to answer the question in your post title : Session.set does work but, as it is stated in the documentation (, Sessions are immutable.
Session.set returns a new Session, with your key set in it.
With your previous code, you returned the previous session, and the result of Session.set, e.g. your Session with the new key set, was discarded.

Got it, thanks Pierre.