# Executing scenarios sequentially for different number of users?

**URL:** <https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914>\
**Category:** Gatling (Open-Source)\
**Created:** [January 21, 2015, 7:59am UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914 "2015-01-21T07:59:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Rivera](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@Roberto\_Rivera](https://community.gatling.io/u/Roberto_Rivera)\
**Post date:** [January 21, 2015, 7:59am UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914/1 "2015-01-21T07:59:45Z")

</div>

Hi,

I have a simulation that I’d like to run multiple times with a different number of users. Basically, I want to see how the application behaves with, say, 100, 200, 300 users.

I tried doing something like this:

`

```auto
val hundred = scenario("100 Users").exec(MyTest.test)
val two_hundred = scenario("200 Users").exec(MyTest.tes)
val three_hundred = scenario("200 Users").exec(MyTest.tes)

setUp(hundred.inject(atOnceUsers(100)),
      two_hundred.inject(atOnceUsers(200)),
      three_hundred.inject(atOnceUsers(300))
).protocols(httpProtocol)

```

`

The problem is that gatling seems to run all of them at once, which sort of defeats my purpose (it’s running with 600 users at once).

Is there any way to achieve this? Am I looking at the problem the wrong way?

Right now I just have a single scenario, and I update the users for every run. Which is a bit cumbersome.

Thanks!  
Roberto

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 21, 2015, 9:53am UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914/2 "2015-01-21T09:53:49Z")

</div>

Hi,

This way, you can at best:

- either use some delay between the different populations with nothingFor
- or split your users  
See [http://gatling.io/docs/2.1.3/general/simulation\_setup.html](http://gatling.io/docs/2.1.3/general/simulation_setup.html)

In Gatling 2.2, you’ll be able to launch multiple simulations sequentially from the maven and the sbt plugins.

Cheers,

---

<div class="post-metadata">

**Author:** ![Abhinav\_Gogna](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Abhinav\_Gogna](https://community.gatling.io/u/Abhinav_Gogna)\
**Post date:** [January 21, 2015, 4:14pm UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914/3 "2015-01-21T16:14:00Z")

</div>

Actually there is a workaround to do this currently.

What you want to do is read number of user from command line arguments [http://gatling.io/docs/2.1.3/cookbook/passing\_parameters.html](http://gatling.io/docs/2.1.3/cookbook/passing_parameters.html)

Then in a batch/shell script call your simulation runs.

Something like

`./gatling.sh`JAVA\_OPTS="-Dusers=100 `-s

`./gatling.sh `JAVA\_OPTS="-Dusers=200 `-s <your fully qualified class name>`

`

I haven’t tried it but some variation of this should work.

---

<div class="post-metadata">

**Author:** ![jarrowwx](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jarrowwx](https://community.gatling.io/u/jarrowwx)\
**Post date:** [January 22, 2015, 3:27pm UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914/4 "2015-01-22T15:27:35Z")

</div>

I’ve done it. I always specify number of users and test run duration from the command line. I also have parameters for ramp time, among other things. I have created wrappers to let me test with varying numbers of users: 1, 2, 5, 10, 20, 50, 75, 100, 150, …

---

<div class="post-metadata">

**Author:** ![Roberto\_Rivera](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@Roberto\_Rivera](https://community.gatling.io/u/Roberto_Rivera)\
**Post date:** [January 26, 2015, 7:45am UTC](https://community.gatling.io/t/executing-scenarios-sequentially-for-different-number-of-users/1914/5 "2015-01-26T07:45:05Z")

</div>

Thanks, Abhinav!

I got it working using parameters.
