constantUsersPerSec(20) during(15 seconds)

i want to run a scenario with single/multiple users for 1 hour, how can i set up my scenario… iam using Gatling 2.2

–for one hour have to run with 2 concurrent users


constantUsersPerSec(2) during(60 minutes)

Make your scenario loop for a finite duration, such as an hour. Inject 2 users. Presto! You have exactly what you wanted.

1.i want to run with constant user for a fixed duration,i tried all the below ones… i am not able to continuously hit the server with a specified user for a specified duration,
apart from the below any functions are there for running a test(scenario) for a long duration(eg…1 hour) with ‘n’ no of users…

nothingFor(4 seconds), // 1
    atOnceUsers(10), // 2
    rampUsers(10) over(5 seconds), // 3
    constantUsersPerSec(20) during(15 seconds), // 4
    constantUsersPerSec(20) during(15 seconds) randomized, // 5
    rampUsersPerSec(10) to(20) during(10 minutes), // 6
    rampUsersPerSec(10) to(20) during(10 minutes) randomized, // 7
    splitUsers(1000) into(rampUsers(10) over(10 seconds)) separatedBy(10 seconds), // 8
    splitUsers(1000) into(rampUsers(10) over(10 seconds)) separatedBy(atOnceUsers(30)), // 9
    heavisideUsers(1000) over(20 seconds)
2.It is not allowing to give the timeunits eg.. (10 minutes) ,only it is allowing the number, which timeunit it will take if we given as a integer (10).
Thanks in Advance


I have attached the sample scala files that i am using to generate the load. i am facing two issues currently

  1. Looks like “pause” is not working which is available in the script

  2. I want the simulation to be executed continuously for an hour

can you please assist us with an example for above to issues

Thanks in advance.

Sample.scala (384 Bytes)

obj_sample.scala (1.03 KB)

If your scenario does one thing and then stops, no amount of injection profile magic can make it “run continuously with N users” - the users will appear, do their work, and then disappear. In order to make the user stick around, you must code it so the user sticks around. That’s why there are loop constructs in the Gatling DSL.

To fully understand it, use a metaphor. Imagine you are hiring people to work for you. Say you want 5 people to beat on your application for an hour. So you hire 5 people. But you give each one about 2 seconds worth of work. They do the work you gave them, and then leave. If you want them to “beat on the application for an hour” you have to tell them “I want you to do X, Y, and then Z, over and over again, for an hour”.

Make sense?