Round robin over scenarios

Hi,

I’ve been lurking for some time now, and usually found solutions to my Gatling woes here.

But this one has me stumped so far.

I’m attempting the following (pseudo code):

during (duration) {

  • round-robin
  • scenario 1
  • scenario 2

  • }

Each scenario can contain exitHereIfFailed, since it’s not feasible to continue after a certain point if a check failed.

But I would like the user to continue to the next scenario, as long as the duration is true.

This is what I have come up with so far:

`

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class DuringErrorSimulation extends Simulation {

val httpProtocol = http
.baseURL(“http://gatling.io”)

val chain_404 = exec(http(“known 404”)
.get("/404")
// .check(status.is(404)) // without this line - the simulation will stop when hitting exitHereIfFailed in (another) chain
)

val chain_index = exec(http(“index”)
.get("/index"))
.exitHereIfFailed

val scn = scenario(“For duration attempt to connect to known 404”)
.during(10 seconds, “testCount”, false) { // (duration, counterName, exitASAP)
roundRobinSwitch(
chain_404,
chain_index
)
}

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

}

`

The above simulation stops before the duration is completed, this is not what I intend, I want it to continue round-robin fashion to the next scenario until the duration is completed.
I’ve been unable to get anything other than chains to work(ish), but I have a notion that wrapping ScenarioBuilder in roundRobin could work - but I’ve yet to discover how.

Also I’m puzzled by exitASAP == false seemingly not having any impact on the usage of exitHereIfFailed.

Any hints are welcome.

Thanks in advance,

DH

DuringErrorSimulation.scala (887 Bytes)

Hi guys,

For future reference, managed to locate a hint here: https://groups.google.com/d/msg/gatling/OK2AFNcHLCk/Viuqr_fWQXQJ

Resulting in the following approach:

`

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class DuringErrorSimulation extends Simulation {

val httpProtocol = http
.baseURL(“http://gatling.io”)

val chain_404 = exec(http(“known 404”)
.get("/404"))
.exec(http(“index”)
.get("/index"))

val scn = scenario(“For duration attempt to connect to known 404”)
.during(3 seconds) {
exitBlockOnFail(chain_404)
}

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

}

`

This approach exits the chain upon check evaluating to false, ie. “index” is not expected to be present in a simulation result.

Example: