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("""/""")
.headers(Config.headers_0)
.resources(http(“request_1”)
.get(Config.uri1 + “”"/scripts/main.js""")
… so on
}
}
object search {
val search = { group (“Search”) {
…
…
}
val httpConf = http
.baseURL(“https://testsite”)
.inferHtmlResources()
.acceptHeader("""/""")
.acceptEncodingHeader(""“gzip, deflate”"")
.acceptLanguageHeader(""“en-gb,en;q=0.5"”")
.connection(""“keep-alive”"")
.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 = “”“https://acceptance.alpha.mygov.scot:81"”"
val scenario1 = scenario(“multiplescenario”).forever() {
randomSwitch{
60 → HomePage.home,
40 → Search.search
}
}
}
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,Search.search)}.during(15 minutes){exec(Search.search,Homepage.home)}
Thanks & Regards,
Rajesh