Gatling 2.0.0-RC2 - Query regarding Gatling Execution errors when using randomSwitch

Hello Gatling Experts,

Gatling Version : 2.0.0-RC2
I’m experiencing errors when trying to use Advanced Simulation Approach, along with randomSwitch. Could you please advise how to resolve this, with possible code snippet.

Class LoadTest extends Simulation {

object HomePage {

val home = { group(“Home Page”) {

exec(http(“home page”) .get("""/""")



.get(Config.uri1 + “”"/scripts/main.js""")

… so on



object search {

val search = { group (“Search”) {


val httpConf = http




.acceptEncodingHeader(""“gzip, deflate”"")



.userAgentHeader(""“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0"”")

val headers_0 = Map(""“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"”")

------ so on

val headers_25 = Map(""“X-Requested-With”"" → “”“XMLHttpRequest”"")


val uri1 = “”“"”"

val scenario1 = scenario(“multiplescenario”).forever() {


60 → HomePage.home,

40 →




Above test is failing with following errors for selected lines

expected class or object definition

I’m able to execute the test after replacing scenario without randomSwitch.

val scenario1 = scenario(“multiplescenario”).during(15 minutes) {exec(HomePage.home,}.during(15 minutes){exec(,Homepage.home)}

Thanks & Regards,


Hi Rajesh,

Have a look at randomSwitch documentation :
Replace the curly braces in your randomSwitch call by parentheses and it should work as expected.



60 → HomePage.home,
40 →





Hi Pierre,

Many thanks for quick response.

After I had modified the test, Test failed with 2 more errors.
The first error seems potential issue with Gatling tool documentation.
Could you advise if any work around to resolve the 2nd error.

Error 1 : This issue resolved upon replacing 20 → 20.0 in randomSwitch. It seems % should always be given in double format.


GATLING_HOME is set to /home/ubuntu/gatling-charts-highcharts-2.0.0-RC2

18:03:45.949 [ERROR] i.g.a.ZincCompiler$ - /home/ubuntu/gatling-charts-highcharts-2.0.0-RC2/user-files/simulations/explore/alpha/mygov/scot/Load.scala:338: type mismatch;

found : (Int, io.gatling.core.structure.ChainBuilder)

required: (Double, io.gatling.core.structure.ChainBuilder)

18:03:45.952 [ERROR] i.g.a.ZincCompiler$ - 20 → HomePage.home,

18:03:45.952 [ERROR] i.g.a.ZincCompiler$ - ^

18:03:46.242 [ERROR] i.g.a.ZincCompiler$ - one error found

Compilation failed

Error 2 : Test Execution completed and following error shown while generating report.

Simulation finished

Generating reports…

Parsing log file(s)…

Parsing log file(s) done

Exception in thread “main” java.util.NoSuchElementException: key not found: List(Content Items)

at scala.collection.MapLike$class.default(MapLike.scala:228)

at scala.collection.AbstractMap.default(Map.scala:58)

at scala.collection.MapLike$class.apply(MapLike.scala:141)

at scala.collection.AbstractMap.apply(Map.scala:58)




at scala.Option.foreach(Option.scala:236)

Thanks & Regards,