Simulation test gatling

Hello,
How do I run a galling test with account creation? I want to run a test with a gradual ramp-up, one user at a time.
My script contains a CSV file with a feeder.
I want to use a piece of data each time, and for that data to be used more frequently.

1 Like

Hi @devendoye!

To run a test that creates accounts using unique data from a CSV, you need to combine rampUsers with a feeder in queue mode. Here’s a full example:

val csvFeeder = csv("usuarios.csv").queue // ← queue = each row is used ONLY ONCE

val createAccount = scenario("Create Account")
  .feed(csvFeeder) // Takes the next row from the CSV
  .exec(http("User Registration")
    .post("/api/users")
    .body(StringBody("""{
      "username": "${username}",
      "email": "${email}",
      "password": "${password}"
    }""")).asJson
  )

setUp(
  createAccount.inject(
    rampUsers(10).during(60.seconds) // 10 users over 60s = 1 user every 6s
  )
)

:page_facing_up: Example CSV (usuarios.csv):

username,email,password
user1,user1@test.com,pass123
user2,user2@test.com,pass456
user3,user3@test.com,pass789

Key Points

:white_check_mark: .queue β†’ Each CSV line is used only once (no repetition)
:white_check_mark: rampUsers(10).during(60.seconds) β†’ Gradually injects 10 users over 60 seconds
:white_check_mark: If you want exactly 1 user every 5 seconds:

constantUsersPerSec(0.2).during(60.seconds) // 0.2 users/sec = 1 every 5s

Feeder Modes

  • .queue β†’ Uses each record once, then fails when it runs out

  • .circular β†’ Loops back to the beginning when it reaches the end

  • .random β†’ Picks rows randomly (can repeat)

If you have 100 users in your CSV and run 100 rampUsers, each one will receive a unique record.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.