Kenny
1
Hi,
I was trying to read all the different post in the google group for related information, but could not find similar solution.
basically i have designed a chainbuilder of several execution. I like to ask if we can pass in session value into a placeholder in feeder ?
i.e.
Feeder file:
-
JSON_string
“parm”: “1”, “value”: “${mySessionValue}”
Scenario Code:
exec(
http(“Check_Status”)
.get("/test")
.check(jsonPath("$.testValue").exists.saveAs(“mySessionValue”))
)
exec(http(“Check_status_2”)
.post("/users/${id}/patternJobs/cluster")
.body("""{${JSON_string}}""").asJSON
)
How can i do this?
Gatling Version: 2.0.0
I dont think that will work.
As a workaround, use the feeder without “${mySessionValue}” and right before “Check_status_2” concatenate string in a session function
Something like
`
exec(
http(“Check_Status”)
.get("/test")
.check(jsonPath("$.testValue")
.exists.saveAs(“mySessionValue”))
)
.exec{session =>
val jsonString_1 = session(“JSON_string”).as[String] + session("mySessionValue").as[String]
exec(http(“Check_status_2”)
.post("/users/${id}/patternJobs/cluster")
.body("""{${JSON_string}}""").asJSON
)
`
Did an accidental post without the entire code.
exec(
http(“Check_Status”)
.get("/test")
.check(jsonPath("$.testValue")
.exists.saveAs(“mySessionValue”))
)
.exec{session =>
val jsonString_1 = session(“JSON_string”).as[String] + session("mySessionValue").as[String]
session.set("jsonString1", jsonString1)
}
.exec(http(“Check_status_2”)
.post("/users/${id}/patternJobs/cluster")
.body("""${jsonString1
}""").asJSON
)
``
`
`
Kenny
4
Yup, looks like there isn’t other solutions.
Thanks.