Dynamically set the key in a formParamMap


I am trying to build out a form based on index values extracted from the response via check.saveAs. When creating the form, the value side of the map has the el expression properly expanded. However, the key side of the map does not get expanded.

The map I am using is:


“NewReserveSet:NewReserveSetScreen:ReservesSummaryDV:EditableReservesLV:${totalReserves}:CostCategory” → “adl”, // <— This is not expanded
“objFocusId” → “NewReserveSet:NewReserveSetScreen:ReservesSummaryDV:EditableReservesLV:${totalReserves}:CostType”) // <— This is expanded

This can be seen in this snippet from session.

NewReserveSet:NewReserveSetScreen:ReservesSummaryDV:EditableReservesLV:${totalReserves}:CostCategory: adl
objFocusId: NewReserveSet:NewReserveSetScreen:ReservesSummaryDV:EditableReservesLV:3:CostType

Is it possible to expand the expressions on the key side of the map? Any help would be appreciated.

I am using Gatling Version 2.2.5.



I have verified this also occurs on 2.3.1.



That’s not support and will not because it would clash with other overloads.

You need to use the formParamMap(map: Expression[Map[String, Any]]), meaning resolve the whole map dynamically altogether, meaning most likely programmatically, not with EL.

Thanks Stephane,

I ended up using .formParam(${key}, value) and that works. This is what the working code looks like (simplified for example).

exec(session =>
session.set(“newReserveSet”, “EditableReservesLV:” + session(“idx”).as[String] + “:NewAmount”))
exec (
http(“Test Name”)
.formParam(“eventSource”, “refresh”)
.formParam("${newReserveSet}", “100”)