I am trying to pass a token from responseHeader of the 1st request to the conseqtive requests in a loop. However, I keep getting error stating the "continuationToken" (as in the example) is not defined
val httpProtocol = http
.baseUrl("some-base-url")
val scn = scenario("Scenario for 'Get store assortments by storeId'")
.exec(http("request_1")
.get("endpoint1")
.header("api-key","api-key")
.queryParam("param", true)
.check(header("continuationToken").saveAs("${continuationToken}")))
.doWhile(session => session("${continuationToken}").as[String] != null) {
exec(http("request_2")
.get("endpoint1")
.header("api-key", "api-key")
.queryParam("param", true)
.queryParam("continuationToken", "${continuationToken}")
.check(header("continuationToken").saveAs("${continuationToken}")))
}
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
Error:
================================================================================
---- Global Information --------------------------------------------------------
> request count 1 (OK=0 KO=1 )
> min response time 129 (OK=- KO=129 )
> max response time 129 (OK=- KO=129 )
> mean response time 129 (OK=- KO=129 )
> std deviation 0 (OK=- KO=0 )
> response time 50th percentile 129 (OK=- KO=129 )
> response time 75th percentile 129 (OK=- KO=129 )
> response time 95th percentile 129 (OK=- KO=129 )
> response time 99th percentile 129 (OK=- KO=129 )
> mean requests/sec 1 (OK=- KO=1 )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms 0 ( 0%)
> 800 ms < t < 1200 ms 0 ( 0%)
> t > 1200 ms 0 ( 0%)
> failed 1 (100%)
---- Errors --------------------------------------------------------------------
> status.find.in([200, 209], 304), found 400 1 (50.00%)
> request_2: Failed to build request: No attribute named 'contin 1 (50.00%)
uationToken' is defined
================================================================================
.saveAs("${continuationToken}")
should be.saveAs("continuationToken")
${
(deprecated syntax, now it's#{
), is used in EL to refer to the session attribute, not when you're creating the session attribute. Giving it such a weird name will make it impossible to parse correctly in EL.