Feeders
Learn about Feeders that provide data to the simulation.
We'll cover the following
In the previous lesson, we learned about throttling. In this lesson, we will learn about the different ways to pass test data to the Gatling test script using Feeders.
What are Feeders?
Feeders supply data to the simulations. Feeders are basically Iterator[Map[String, T]]
.
During the execution of a scenario, every user is fed with the same Feeder. However, every time the user reaches this step, Gatling will pop a record out of the Feeder, which will be injected into the user’s session, resulting in a new session instance for that user.
Types of Feeders
Continuous iterator
For generating records continuously until the simulation ends (in our case, a random number between 0 and 100), we can use the following:
import java.util.concurrent.ThreadLocalRandom._
def randomNumber(start: Int, end: Int) = current().nextInt(start, end + 1);
val feeder = Iterator.continually(Map("random_number" -> randomNumber(1, 100))
Get hands-on with 1400+ tech skills courses.