Getting io.gatling.commons.validation.Validation Error

Hi All,

I’m trying to capture the account ids for a given user and trying to loop through all the ids in the below code.

val scn11 = scenario(“ListAccounts_AC”)
.exec(http(“GetAssociatedAccounts_AC”)
.get(“https://xxxxxx.co.uk/v1/accounts”)
.header(“Authorization”, “Bearer YYYYYYYYYYYYYYYYYYYYYYYYYYYYY”)
.header(“Content-Type”, “application/json”)
.check(regex("“bban”:"(.+?)"}").findAll.saveAs(“bban”))

//.exec(session =>session.set(“SortCode”,session(“bban”).as[String].toString.slice(3,6)))
.check(status.is(200)))
.foreach("${bban}", “bban_id”)
{
exec(session => {
println( “bban is>>>>>>>>>>> :” + “${bban_id}”)
}
)
}

But getting the below error.

RecordedSimulation7.scala:50:32: type mismatch;
found : Unit
required: io.gatling.commons.validation.Validation[io.gatling.core.session.Session]
println( “bban is>>>>>>>>>>> :” + “${bban_id}”)

Please can you suggest what i’m doing wrong.

Regards,
Prash.

Hi All,

Slightly different question from my post below.

.check(regex("“bban”:"(.+?)"}").findAll.saveAs(“bban”))

The above check is returning the below list

List(PRFG04125200000022, PRFG04125200000017, PRFG04125200000010)

is there a way to extract last 8 characters of each value i.e. 00000022,00000017,00000010

Regards,
Prash.

Use transform: https://gatling.io/docs/current/http/http_check/#http-check-transform

Thanks Stephane !!!

I managed to get the expected result by using different endpoint. However, i’ll keep in mind the option you suggested.

Kind Regards,
Prash.