testinggatling

Gatling user injection for 50 total users in 1 hour adding 10 users per 5 minutes


I need to setup a Gatling Test with a total of 50 concurrent users, but I have a problem because there is no choice to get it.

I use rampUsers(10) over (60 minutes) but it gets only 10 concurrent users.
Using constantUsersPerSec(users) during (60 minutes) is too stressful.

Is there any suggestion?

Thanks.


Solution

  • This could be done as follow:

    val scn = scenario("Test").during(1 hours) {
      exec(http("test").get("/"))
    }
    setUp(scn.inject(splitUsers(50) into atOnceUsers(10) separatedBy(5 minutes))
      .protocols(httpConf))
    

    see https://docs.gatling.io/reference/script/core/simulation/#setup:

    splitUsers(nbUsers) into(injectionStep) separatedBy(duration): Repeatedly execute the defined injection step separated by a pause of the given duration until reaching nbUsers, the total number of users to inject.