Config included below, but basically what I want to do is:
-
define a chain of two requests, the second depending on the first
-
have users keep executing that chain for some period of time
I created a chain with two “exec” calls, and then wrapped that in a “during”. The first exec (“get_code”) is getting run the number of times I’d expect (for the config below, about 1000 times over 40s), but the second one (“exchange_code”) seems to happen around (but not always exactly) once for each user (in my last run, it happened 11 times; in a run with 60 users, it will get called ~60 times).
Just getting started with Gatling. Am I missing something obvious? Or does this not work the way I’m expecting it to?
This is using v1.5.3
Thanks,
John.
class Auth2SimpleSimulation extends Simulation {
val durationSeconds = 30
val httpConf = httpConfig
.baseURL(“https://example.com”)
.disableFollowRedirect
val urlFormPostHeaders = Map(
“Content-Type” → “application/x-www-form-urlencoded”)
val chain =
exec(
http(“get_code”)
.post("/rest/v2/auth/code")
.headers(urlFormPostHeaders)
.param(“gameId”, “loadtest”)
.param(“provider”, “anonymous”)
.check(status.is(200))
.check(jsonPath(“code”).find.saveAs(“auth_code”)))
.exec(
http(“exchange_code”)
.post("/rest/v2/auth/token")
.headers(urlFormPostHeaders)
.basicAuth(“test”, “test”)
.param(“grantType”, “authorization_code”)
.param(“code”, “${auth_code}”)
.check(status.is(200)))
val scn = scenario(“Basic Login”)
.during(durationSeconds) {
chain
}
setUp(scn.users(10).ramp(10).protocolConfig(httpConf))
}