Gatling EL: Session-Attribute as "access by key"

Gatling version: 3.13.5
Gatling flavor: scala
Gatling build tool: maven

Hi,

I’m actually facing an issue by using the Gatling EL for accessing a Map from the session.

This is the StringBody-definition (part of):

httpRequest.body(
StringBody(s"username=${SessionValue(SessionAttributeConstants.UserIdVarToken)}&pas….

This “${SessionValue(SessionAttributeConstants.UserIdVarToken)}” resolves into

#{keepValues.userIdToken}

and this is the error (part of):

i.g.h.a.HttpRequestAction - Failed to build request Login User: HashMap(passwordToken → …., userIdToken → …., …..) named ‘keepValues’ does not support access by key

The Map is instantiated like this:

session.set(SessionAttributeConstants.SessionKeepValuesMap, mutable.Map[Any, Any]())

This SessionAttributeConstants.SessionKeepValuesMap resolves into “keepValues”.

It results in a HashMap as you can see in the error documented above.

What am I missing?

Thanks a lot for any feedback and support.

Hi,

#{keepValues.userIdToken}

session.set(SessionAttributeConstants.SessionKeepValuesMap, mutable.MapAny, Any)

Gatling Expression Language doesn’t support Scala mutable Seqs and Maps atm. Only immutable ones.

Okay, thanks a lot for your feedback.

FYI, will be supported in 3.15.0: Core: support Scala mutable Seq and Map in Gatling EL · Issue #4682 · gatling/gatling · GitHub