Not able to set session attribute


I am trying to execute a sequence of chains and setting a session attribute in between somewhere. The problem is this variable is not getting set correctly and I get an error saying No attribute named ‘toUpdate’ is defined. Here is the code

No attribute named ‘toUpdate’ is defined

scenario(“Test”).exec(postChain("/orders", Helper.generateRequestBody(order)))
.exec(getChain("/orders", “${id}”))
.exec((session: Session) => {

val jsonString = session(“object”).as[String]
val pojo = Helper.generatePojo(jsonString, classOf[Order]).asInstanceOf[Order]
pojo.setName(pojo.getName + “Updated”)
val toUpdate = Helper.generateRequestBody(pojo)
session.set(“toUpdate”, toUpdate)
.exec(putChain("/orders", “${id}”, “${toUpdate}”))

I want to do the chains in this sequence POST → GET → UPDATE → DELETE and need the toUpdate attribute for the PUT request . Any suggestions?


Hi Akash,

As stated in the documentation(, Sessions are immutable and session.set(…) returns the modified session, which is discarded in your case.
Simply remove the last “session” in your exec block and it’ll work.



Works now ! Thanks a lot Pierre !