I’m very new to Scala and Gatling. I was exploring session attributes of Gatling. I need help in Get of multivalued session attributes on Gatling 2 M3a
I set a session attribute
val myMap = Map((“x”, email), (“y”, “dummy1”), (“z”, “dummy2”));
session.set(“abc”,myMap);
in subsequent Exec, I’m unable to compile the with,
val mm1=session(“abc”)(“x”);
println(“eMail:-----------------------------” +mm1);
Thank you Stéphane for your quick response. I do need to research Scala Options, thanks for that tip.
However when I use val mm=session(“abc”).as(Map[String, String]);
I get the following compile error:
06:32:17.317 [ERROR] i.g.a.ZincCompiler$ - /Users/schatterjee1/dev/gatlingm3/user-files/simulations/PersonSvc.scala:54: missing arguments for method apply in class GenMapFactory;
follow this method with `_’ if you want to treat it as a partially applied function
06:32:17.319 [ERROR] i.g.a.ZincCompiler$ - val mm=session(“abc”).as(Map[String, String]);
06:32:17.320 [ERROR] i.g.a.ZincCompiler$ - ^
My bad, I was using .as(Map[String, String]) and not .as[Map[String, String]] (square brackets)
Thank you for your time in helping resolve this one. Appreciate it.