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”)
.get("/something"))
.check(bodyString.transform(str => str.replace(""", “”)).saveAs(“installId”))
.exec((session => {
installId = session(“installId”).as[String].trim
session
}))
}
object B {
val ab= exec (http(“Scenario B”)
.get("/something")
.check(bodyString.transform(str => str.replace(""", “”)).saveAs(“AppID”))
.exec((session => {
installId = session(“installId”).as[String].trim
session
}))
}
object C {
.exec(_.set(“installId”, installId))
val c = exec (http(“Scenario C”)
.get("/something/${installId}"))
}
object D {
val d = exec(_.set(“AppID”, AppId))
.exec (http(“Scenario D”)
.get("/something/${AppId}"))
}
val scenario1 = scenario(" A and B").exec(A.a , B.b)
val scenario2 = scenario(“C and D”).exec(C.c , D.d)
setUp(
scenario1.inject(rampConcurrentUsers(0) to appUsers during (appRunTime seconds)),
scenario2inject(nothingFor(20 seconds) , rampUsers(eventUsers) during (eventUsers seconds))
).protocols(httpProtocol)
Thanks,
Sachin Balusu