# Dynamically injecting scenarios

**URL:** <https://community.gatling.io/t/dynamically-injecting-scenarios/3370>\
**Category:** Gatling (Open-Source)\
**Created:** [November 8, 2016, 11:23pm UTC](https://community.gatling.io/t/dynamically-injecting-scenarios/3370 "2016-11-08T23:23:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Udstrand](https://avatars.discourse-cdn.com/v4/letter/g/5f8ce5/32.png) [@Gary\_Udstrand](https://community.gatling.io/u/Gary_Udstrand)\
**Post date:** [November 8, 2016, 11:23pm UTC](https://community.gatling.io/t/dynamically-injecting-scenarios/3370/1 "2016-11-08T23:23:50Z")

</div>

I want to be able to define the distribution of scenarios for a given simulation. I currently have four scenarios; lets call them a, b, c, and d. In a config file I have a percentage listed for each. In my simulation class I then inject each one using the setup method, like so:

```auto

```

```auto

setUp(
    injectScenario(a, ausers, ramp, dur),
    injectScenario(b, busers, ramp, dur),
    injectScenario(c, cusers, ramp, dur),
    injectScenario(d, dusers, ramp, dur)
  ).protocols(httpConf)

The method injectScenario injects the users over a ramp/duration interval and then returns a PopulationBuilder. Everything works great except if I have a scenario for which I want 0 users (or 0 percent). I get an error that user has to be greater than zero. I am trying to figure out a way to not inject that scenario if the user count is not greater than zero. Is there a way I can add scenarios without doing it via the 

```

```auto
setup method? Is there another mechanism for injecting dynamic scenarios?  

```

```auto

```

```auto
Thanks

```

```auto
-Gary

```
