Assign Map to session variable

Hi Friends,

Im new to gatling, I have gone through the documents.
Im trying to set a Map to session variable. In scenario A i setup the value and used it in scenario B. I could not get the value.

Scn A {

.exec { session =>
val cdMap = Map(“cd1” → “101”, “cd2” → “909”)

Scn B {


No errors displayed. I captured the response it is showing the below 
"{"success":false,"payload":{},"tech_msg":"Invalid status provided.",
"friendly_msg":"Invalid status provided.","authenticated":true}


1. Im using same session between Scn A and Scn B
2. In Scn B i declared val cdMap and used it in Param, it works.( anyway it is not a session variable:) )
3. Im using Gatling 3.0

**Need help with:**
1. Access the session variable between scenarios
2. Display the session variable in console.

Hope i get it resolved :D

Thank you.

I usually do like this … though i have not tried this between scenarios … Give a try…

.exec(session => {




.body(StringBody(session => session(“AAAA”).as[String])).asXml


Friends can some one help me here :slight_smile:

Gatling use group. Can you reply on any solution.

Is this a bug in 3.0???

*try this out :)*

var formParam_Map: scala.collection.immutable.Map[String,Any] = scala.collection.immutable.Map()

.repeat(numberOfMessages) {
      exec { session =>
        var map_set: scala.collection.immutable.Map[String, Any] = scala.collection.immutable.Map()
        val mess_id = session("message_id").as[Vector[String]]
        val ver = session("version").as[Vector[String]]
        val src_id = session("source_id").as[Vector[String]]
        val idx = session("index").as[Vector[String]]
        map_set = Map("messages[" + initialVal + "][id]" -> mess_id(initialVal))
        initialVal = initialVal + 1
        formParam_Map = formParam_Map ++ map_set.toMap
        session.set("formParam_Map", formParam_Map)
    .exec(http("test: " + "${formParam_Map}")