Hi folks,
I am using gatling2.2.5 to simulate requests in a loop. The logic is: the client continuously sends requests to server; everytime server returns a token; the client will stop once it receives an empty string “” for token.
I use doWhile to implement the loop and here is the code snippet:
`
val scn = scenario(“FetchItemListInLoop”)
.doWhile(session=>session(“token”).as[String].length()>0){
exec(http(“fetch items”)
.get("/example/list/")
.check(jsonPath("$…token").saveAs(“token”))
)
}
`
However, I got the compiling error “value doWhile is not a member of io.gatling.core.structure.ScenarioBuilder”. Below is the error information:
11:51:11.658 [ERROR] i.g.c.ZincCompiler$ - **value doWhile** **is not a member of io.gatling.core.structure.ScenarioBuilder** possible cause: maybe a semicolon is missing before
value doWhile’?
11:51:11.661 [ERROR] i.g.c.ZincCompiler$ - .doWhile(session=>session(“token”).as[String].length()>0){
11:51:11.661 [ERROR] i.g.c.ZincCompiler$ - ^
`
I don’t understand why the compiler reports this error because I just followed the APIs in http://gatling.io/docs/current/general/scenario/.
Any help is greatly appreciated !!!
Thanks,