Hello,
I’m trying to change variable
val scn = scenario(“RecordedSimulation”)
.exec(http(“request_0”)
.post("/path")
.check(jsonPath("$.some_token").saveAs(“token”))
)
.exec( _.set(“token”, “some phrase” + “$token”)
.exec(session=>{
val maybeId = session.get(“token”).asOption[String]
println(maybeId.getOrElse(“COULD NOT FIND ID”))
session
})
But it prints
some phrase$token
I tried
.exec( _.set(“token”, “some phrase” + “${token}”))
shows
some phrase${token}
I tried
.exec( session=> {
session.set(“token”, “some phrase” + session.get(“token”).asOption[String])
})
returns
some phrase Some(ldskjgfdslkjgolds)
I tried
.exec( session=> {
session.set(“token”, “some phrase” + session.get(“token”).asOption[String].getOrElse(“COULD NOT FIND ID”))
})
and got result that I want
some phrase ldskjgfdslkjgolds
But is there any other short method to get such result?