Gatling multiple scenarios with multiple concurrent users

85 views
Skip to first unread message

sachinb...@gmail.com

unread,
Nov 16, 2020, 9:16:03 AM11/16/20
to Gatling User Group
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



Stéphane LANDELLE

unread,
Nov 16, 2020, 12:18:24 PM11/16/20
to gat...@googlegroups.com
No idea what your problem is. Have you read the doc? https://gatling.io/docs/current/general/simulation_setup/#closed-model

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

Logo Stéphane Landelle
Chief Technical Officer
twitter: @slandelle
site:
gatling.io




--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/caeb0917-dfda-470e-b6d3-a95483df3e09n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages