I have this (partly simulation):
`
.exec(
http(“getCardList”)
.get("/card/all")
.header(“X-Token”, “my_token”)
.check(status.is(200))
.check(jsonPath("$.resultCode").is(“SUCCESS”))
.check(jsonPath("$.membershipCard[0].card[0].offerId").saveAs(“offerId”)))
.exec(session2 => {
println((session2(“offerId”).as[String]))
session2
})
.exec(
http(“activateCard”)
.post("/card/activate")
.header(“X-Token”, “my_token”)
.body(StringBody("""{“offerId”: “${offerId}”, “membershipId”: “1361300168”, “osName”: “Android”, “osVersion”: “4.4”}""")).asJSON
//.body(ELFileBody(“activateCard.json”)).asJSON
.check(status.is(200))
.check(jsonPath("$.resultCode").is(“SUCCESS”)))
`
In the last .exec I am trying to use the variable saved in the first .exec without any luck.
It fails. But when ‘hard-coding’ the variable into the StringBody it works. I have verified that ‘offerId’ is captured using my reggae and print.
Is it possible to pass one variable (offerId) from one .exec to the next?
I am actually using ELFileBody and a request body with the parameter ‘offerId’ but that did not work either, so I am using StringBody to ‘debug’.
Please advice,
Magnus