How to setup gatling test scenario

In a Gatling test, the setUp method is used to specify the scenario that will be run during the test. In the code below, the scenario is specified using the scn variable, which presumably refers to a scenario that has been defined elsewhere in the code. val nbUsers = Integer.getInteger("users", 1000) val myRepeat = java.lang.Long.getLong("repeat", 2) val httpProtocol = http.baseUrl("http://localhost:8080") val scn = scenario("hello").repeat(myRepeat.toInt) { exec(http("GetApplicationInfo") .get("/hello") .check(status.is(200)) .check(jsonPath("$.name"))) } setUp( scn.inject( rampUsers(nbUsers) during (5 seconds) ).protocols(httpProtocol) ) The inject method is used to specify how the users will be introduced into the system under test. In this case, the rampUsers method is used to gradually increase the number of users over a period of 5 seconds. This is known as a ramp-up. The total number of users to be injected is specified by the nbUsers variable. ...

December 12, 2022 · 2 min · Özkan Pakdil

Gatling parameterize

In order to send testing parameters from command line like below mvn -ntp -f $retDir/gatling/pom.xml gatling:test -Dusers=2000 -Drepeat=3 these users and repeat can be used from load scala like below class LoadTest extends Simulation { val nbUsers = Integer.getInteger("users", 1000) val myRepeat = java.lang.Long.getLong("repeat", 2) val httpProtocol = http.baseUrl("http://localhost:8080") val scn = scenario("hello").repeat(myRepeat.toInt) { exec(http("GetApplicationInfo") .get("/hello") .check(status.is(200)) .check(jsonPath("$.name"))) } setUp( scn.inject( rampUsers(nbUsers) during (5 seconds) ).protocols(httpProtocol) ) } that test will send nbUsers of request to localhost:8080/hello myRepeat times, For full file check and how to call it from here ...

March 12, 2022 · 1 min · Özkan Pakdil