Hi Gatling community!
Could you please help with the following issue:
In Gatling test I want to get requests from Wiremock and save some data (e.g. “responseId”).
I’m trying to use loop and save find(0), find(1)… find(n) elements to the session. But when I used find("${id}".toInt) in my code Gatling returns error: java.lang.NumberFormatException: For input string: “${id}”
At the same time ${id} returns needed value for exec(http()) section.
Please take a look at code below and help me define what is wrong:
val users = 2
val finiteFeeder = (for (i <- 0 until users) yield {
Map("id" -> s"$i")
})
val parseLogs: ScenarioBuilder = {
scenario("Parse logs")
.repeat(users) {
feed(finiteFeeder)
.exec(http("Get mock service request ${id}")
.get("/__admin/requests/")
.body(StringBody("""{ "method": "POST", "url": "/api/v4.1/event/sync" }""")).asJson
.check(jsonPath("$..id").find("${id}".toInt).saveAs("responseId"))
)
}
}
Thank you in advance!