Passing session variables between 2 scenarios

Hi All,

I have 2 scenarios in my gatling script. Both of these scenarios point to 2 different domain (baseurl), hence i cannot make them in same scenario.

A session variable captured in scenario 1, needs to be used in scenario 2. How can i accomplish this?

val Scenario1= scenario(“First Scenario”)

.exec(http(“Scenario1-Request-1”)
.get(“url1”)
.headers(headers_55).disableFollowRedirect.check(status.is(200)).check(bodyString.saveAs(“Variable1”)))

.exec(session => {
val String1= session(“Variable1”).as[String]
session.set( “String1”, String1)
session
})

val Scenario2=scenario(“Second Scenario”)
.exec(http(“Scenario2-Request-1”)
.get("${ String1}")

Scenario :
setUp(Scenario1.inject(atOnceUsers(1)).protocols(httpProtocol),
Scenario2.inject(nothingFor(30),atOnceUsers(1))
)

Scenario is waiting doing nothing as the first step is to use the variable captured in scenario1 to do rest of the steps. ${String1} in Scenario2 is not getting resolved.

Any help much appreciated. Thank you !

Hi Stephane,

Could you please comment if the above is even possible? If yes, is there any documentation that you can provide me?

Regards,
Maithrie