Gatling multiple scenarios with multiple concurrent users

Hi team,

I am new to Gatling and Gatling frontline. I have a simulation with 4 different objects defined. I need to run scenario a and b with 1 concurrent user and scenario c and d with 1000 concurrent users . is there a way i can do that in a single simulation? I have tried the code below but it runs the simulation for 1 users only, is there a better way to run these kind of simulations.
Scenario explanation: I want the Object A and B to run for 1 user , then get the Install and appId and run the other two scenarios for 100 users.

Note: I am also passing two ID’s from scenario A and B to Scenario C,D.

Test code:

val appUsers = 1
val eventUsers = 100

var installId= " "
var AppId = " "

object A {
val a = exec (http(“Scenario A”)
.check(bodyString.transform(str => str.replace(""", “”)).saveAs(“installId”))

.exec((session => {
installId = session(“installId”).as[String].trim


object B {
val ab= exec (http(“Scenario B”)
.check(bodyString.transform(str => str.replace(""", “”)).saveAs(“AppID”))

.exec((session => {
installId = session(“installId”).as[String].trim


object C {
.exec(_.set(“installId”, installId))

val c = exec (http(“Scenario C”)

object D {
val d = exec(_.set(“AppID”, AppId))
.exec (http(“Scenario D”)

val scenario1 = scenario(" A and B").exec(A.a , B.b)
val scenario2 = scenario(“C and D”).exec(C.c , D.d)

scenario1.inject(rampConcurrentUsers(0) to appUsers during (appRunTime seconds)),
scenario2inject(nothingFor(20 seconds) , rampUsers(eventUsers) during (eventUsers seconds))

Sachin Balusu

No idea what your problem is. Have you read the doc?

scenario1.inject(constantConcurrentUsers(1) during (100 seconds)),
scenario2inject(constantConcurrentUsers(1000) during (100 seconds))