I want basically to add some load to some apis mocking user flow. Something like ramp up to 20 users that do the same thing all the time for a period of time and then ramp down
private val httpProtocol = http
.baseUrl(baseUrl)
.doNotTrackHeader("1")
.header("Content-Type", "application/json")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Gatling load test")
.disableFollowRedirect
private val scn = scenario("User login")
.exec(http("login successful")
.post("/customer-service/api/login")
.body(StringBody("""{ "username": "test@mail.com", "password": "12345" }"""))
.check(status.is(200)))
setUp(scn.inject(rampUsers(20) during (20 minutes))).maxDuration(10 minutes)
At the moment I can see how the users are ramping up but terminating after they do one request. In the active user graph I can see a peaky mountain rather than the expected rampup slope then a steady line and then a ramp down line to 0
Thanks!
I want basically to add some load to some apis mocking user flow. Something like ramp up to 20 users that do the same thing all the time for a period of time and then ramp down
private val httpProtocol = http
.baseUrl(baseUrl)
.doNotTrackHeader("1")
.header("Content-Type", "application/json")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Gatling load test")
.disableFollowRedirect
private val scn = scenario("User login")
.exec(http("login successful")
.post("/customer-service/api/login")
.body(StringBody("""{ "username": "[test@mail.com](mailto:test@mail.com)", "password": "12345" }"""))
.check([status.is](http://status.is)(200)))
setUp(scn.inject(rampUsers(20) during (20 minutes))).maxDuration(10 minutes)
At the moment I can see how the users are ramping up but terminating after they do one request. In the active user graph I can see a peaky mountain rather than the expected rampup slope then a steady line and then a ramp down line to 0
UP
Thanks!
UPDATE: I found what was missing:
private val httpProtocol = http
.baseUrl(baseUrl)
.doNotTrackHeader("1")
.header("Content-Type", "application/json")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Gatling load test")
.disableFollowRedirect
private val scn = scenario("User login")
.during(3 minutes) {
exec(http("login successful")
.post("/customer-service/api/login")
.body(StringBody("""{ "username": "test@mail.com", "password": "12345" }"""))
.check(status.is(200)))
}
setUp(
scn.inject(rampUsers(20) during (1 minutes)),
).protocols(httpProtocol)
Wrapping it with a during makes it repeat the flow again and again for a period of time. So in my code it takes 1 minute to ram up users then 3 minutes steady load and another 1 minute to rampdown