How to combine a repeat and randomSwitch?

Snippet of what I am trying to do.

val scn1 = scenario(“Scenario1”)
.exec(Auth.sign_in_user)
.repeat(10)
{
exec(Widget.widget)
.randomSwitch
(
90 → exec(Ask.ask),
10 → exec(Answer.answer)
)
}
.exec(Auth.sign_out)

Disclaimer - I currently have limited Scala experience.
BTW - this tool is awesome coming from a JMeter background.

Jimmy

What is the issue ?

Nicolas

I just did a quick test, the following :

val scn1 = scenario(“Scenario1”)
.exec(http(“request1”).get("/"))
.repeat(10) {
randomSwitch(
90 → exec(http(“request90”).get("/")),
10 → exec(http(“request10”).get("/")))
}
.exec(http(“request2”).get("/"))

gives me :

First off Thank You for the quick reply!!!

I tried your code snippet and end up with a Zinc compiler error. Ideas?

ambiguous reference to overloaded definition,
both method randomSwitch in trait ConditionalStatements of type (possibility1: com.excilys.ebi.gatling.core.structure.ChainBuilder, possibility2: com.excilys.ebi.gatling.core.structure.ChainBuilder, possibilities: com.excilys.ebi.gatling.core.structure.ChainBuilder*)com.excilys.ebi.gatling.core.structure.ChainBuilder
and method randomSwitch in trait ConditionalStatements of type (possibility1: (Int, com.excilys.ebi.gatling.core.structure.ChainBuilder), possibilities: (Int, com.excilys.ebi.gatling.core.structure.ChainBuilder)*)com.excilys.ebi.gatling.core.structure.ChainBuilder
match expected type ?
10:44:32.103 [ERROR] c.e.e.g.a.ZincCompiler$ - randomSwitch
10:44:32.104 [ERROR] c.e.e.g.a.ZincCompiler$ - ^
10:44:32.122 [ERROR] c.e.e.g.a.ZincCompiler$ - one error found

Which version of Gatling are you using?

I try this simulation against Gatling 1.5.0 and it works as expected.

file Nicolas.scala:

import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
import assertions._

class Nicolas extends Simulation {

val httpConf = httpConfig
.baseURL(“http://localhost:5000”)
.disableResponseChunksDiscarding

val scn1 = scenario(“Scenario1”)
.exec(http(“request1”).get("/"))
.repeat(10) {
randomSwitch(
90 → exec(http(“request90”).get("/")),
10 → exec(http(“request10”).get("/")))
}
.exec(http(“request2”).get("/"))

setUp(scn1.users(2).protocolConfig(httpConf))
}

Ok. I tried your simulation file and it worked. Then I went back to the code snippet in my simulation and it worked.

Strange…For the record I am using 1.5.

Thanks for your help!!!

Cheers,
Jimmy