Not possible to use an else block only with pause(x)??

Hi guys,

I’m getting a strange error… I was trying to build a .doIfOrElse block but the only thing that I need inside the else is a pause.

03:30:29.906 [ERROR] i.g.a.ZincCompiler$ - /Users/vilacap/development/gatling/simulations/sbw/UserJourneyModified.scala:198: type mismatch;
found : io.gatling.core.structure.ChainBuilder
required: io.gatling.core.session.Session
03:30:29.908 [ERROR] i.g.a.ZincCompiler$ - pause(15)
03:30:29.908 [ERROR] i.g.a.ZincCompiler$ - ^

.doIfOrElse("${var}", “”“true”""){

exec(http(“Something
.get(”""/something""")
.headers(headers_12))

}{
pause(15)
}

Thanks
Pedro

doIfOrElse’s first param list only takes one parameter, maybe you’re confusing with doIfEqualsOrElse.
So this should either be:

.doIfOrElse("${var}"){ // assuming var value is a boolean

exec(http(“Something
.get(”""/something""")
.headers(headers_12))

}{
pause(15)
}

or

.doIfEqualsOrElse("${var}", “”“true”""){ // assuming var value is the String value of a boolean

exec(http(“Something
.get(”""/something""")
.headers(headers_12))

}{
pause(15)
}

Both compile fine for me.

Thanks Stéphane!