Hi there, currently I am facing an unexpected behavior where the string interpolation doesn’t work as my expected, here is the code that I am using base on Gatling doc here and here
.exec{
session =>
//This is the data, which returns a String
val responseString = session.attributes.get("theString").toString().slice(21,28)
val newKeyVar = session.set("myKey", responseString)
newKeyVar
}
.exec(
http("Complete_Pairing")
.post(s"url")
.header("Content-Type","application/json")
.body(StringBody(s"""{
"dataField": {"param": "#{newKeyVar}"}
}"""))
.check(status.is(200))
)
I am expecting that I can take out the String value from variable newKeyVar to pass in the post request below, it seems that the compiler could not find the value of this variable, what could be the wrong input here?