I am executing cursor pagination loop for millions of data
but I receive errors at attributes
.exec(http("Test:Generate Cursor ID")
.get("/test")
.queryParam("sortField", "ID")
.queryParam("limit", 100)
.queryParam("cursor", "")
.check(status.is(200))
.check(jsonPath("$.nextCursor").saveAs("TestCursorID"))
)
.doWhile(session => session("CursorID").as[Option[String]].isDefined) {
exec(http("Test:Cursor Pagination")
.get("/test")
.queryParam("sortField", "ID")
.queryParam("limit", 100)
.queryParam("cursor", "#{TestCursorID}")
.check(status.is(200))
.check(jsonPath("$.nextCursor").optional.saveAs("CursorID"))
)
}
I am receiving below error
Please help me with error
12:49:53.969 [gatling-1-6] DEBUG io.gatling.commons.validation.package$ - j.l.ClassCastException: Can’t cast attribute ‘CursorID’ ‘QUZURVI6aWQ6MDAwMDAwMTAtMDAwMC0wMDEwLTAwMDUtMDAwMDAwMDQ4MzIx’ of type class java.lang.String into class scala.Option
java.lang.ClassCastException: Can’t cast attribute ‘CursorID’ ‘QUZURVI6aWQ6MDAwMDAwMTAtMDAwMC0wMDEwLTAwMDUtMDAwMDAwMDQ4MzIx’ of type class java.lang.String into class scala.Option
at io.gatling.commons.util.LowPriorityTypeCaster$$anon$1.cast(TypeHelper.scala:58)
at io.gatling.commons.util.TypeHelper$.cast(TypeHelper.scala:320)
at io.gatling.core.session.SessionAttribute.as(Session.scala:47)
at CursorBasedPaginationScript.CursorPaginationOnTestScenarioSimulation.$anonfun$scn$3(CursorPaginationOnTestScenarioSimulation.scala:94)
at io.gatling.core.session.package$RichExpression$.$anonfun$safe$extension$1(package.scala:49)
at io.gatling.commons.validation.package$.safely(package.scala:30)
at io.gatling.core.session.package$RichExpression$.$anonfun$safe$1(package.scala:49)
at io.gatling.core.action.builder.LoopBuilder.$anonfun$build$1(LoopBuilder.scala:49)
at io.gatling.core.session.LoopBlock$.continue(Block.scala:38)
at io.gatling.core.action.InnerLoop.execute(Loop.scala:83)
at io.gatling.core.action.Action.$bang(Action.scala:41)
at io.gatling.core.action.Action.$bang$(Action.scala:38)
at …