Use this file to discover all available pages before exploring further.
Hardcoded or repetitive test data is one of the most common causes of misleading load test results. When every virtual user sends the same username, email address, or product ID, caches warm up unrealistically, database indexes only cover a tiny key space, and the load test ends up measuring a scenario that can never happen in production. This guide explains how to generate dynamic, realistic, and diverse test data — from Faker-style synthetic values to securely retrieved secrets — so your simulations reflect the true variety of production traffic.
DataFaker is a Java library that generates realistic fake data: names, addresses, emails, phone numbers, credit card numbers, and hundreds of other categories.
The pattern is always the same: create a Faker instance, then wrap Stream.generate in an iterator() call so Gatling gets an infinite, lazy source of fresh records.
1
Create the Faker instance
import net.datafaker.Faker;Faker faker = new Faker();
For scenarios that require unique transaction IDs, correlation tokens, or idempotency keys, Java’s built-in UUID.randomUUID() is the simplest option — no extra dependency required.
When you want a reproducible, static data file rather than runtime-generated values — useful for keeping test runs deterministic — generate the CSV file once before the simulation.
import java.io.*;import java.nio.file.*;import net.datafaker.Faker;public class CsvGenerator { public static void main(String[] args) throws IOException { Faker faker = new Faker(); Path output = Paths.get("src/test/resources/data/users.csv"); try (BufferedWriter writer = Files.newBufferedWriter(output)) { writer.write("username,email,password\n"); for (int i = 0; i < 10_000; i++) { writer.write( "user" + i + "," + faker.internet().emailAddress() + "," + faker.internet().password() + "\n" ); } } System.out.println("Generated " + output.toAbsolutePath()); }}
When your simulation needs real credentials — API keys, auth tokens, database passwords — retrieve them from AWS Secrets Manager at simulation startup rather than embedding them in files or environment variables that might leak into logs.
This approach requires Gatling Enterprise Edition with private locations and the AWS SDK for Java 2.x. The secret is fetched once per load generator, not once per virtual user.