User Injection Profiles
Get familiarized with user injection profiles.
In the previous lesson, we learned about the different ways to pass test data to the Gatling test script using Feeders. In this lesson, we will learn about the different ways to inject users into the simulation.
Gatling provides various ways to inject users and stimulate the load on the environment.
atOnceUsers
Injects a specific number of users at the same time.
Example:
scn.inject(atOnceUsers(10))
Press + to interact
import io.gatling.core.Predef._import io.gatling.http.Predef._class SampleSimulation extends Simulation {val httpProtocol = http.baseUrl("http://localhost:8080/api/users").acceptHeader("*/*").doNotTrackHeader("1").userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0").disableWarmUp.disableCachingval getScenario = scenario("BasicSimulation - GET").exec(http("GET request").get("/").check(status.is(200)))setUp(getScenario.inject(atOnceUsers(10))).protocols(httpProtocol)}
constantUsersPerSec
Injects the number of users each second for the given duration.
Example:
scn.inject(constantUsersPerSe
...