简体   繁体   中英

How to pass correlated value in next request in Gatling script

How can I replace "details1" in "request_2" with correlated value "SynchToken" from "request_1". I am trying to replace with ${SynchToken} but it is not reflecting the correlated value.

val Transaction_Name_1 = group("Transaction_Name_1") {
  exec(http("request_1")
    .get(session => "/abc/details1?_=" + System.currentTimeMillis())
    .check(regex("""name="SYNCHRONIZER_TOKEN" value="(.*?)"""").saveAs("SynchToken")))
  .pause(5)
  .exec(http("request_2")
    .get(session => "/abc/details1?_=" + System.currentTimeMillis()))
}

You should really spend some time reading the documentation. Here, you need to use the Session API .

exec(http("request_2")
    .get(session => "/abc/" + session("SynchToken").as[String] + "?_=" + System.currentTimeMillis()))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM