0
votes

I have multiple Gatling simulations defined in this manner (imports removed).

class MySimulation1 extends Simulation {
    object SimulationObj1 {
        var feeder = ...
        var random = exec(...)
    }

    val httpProtocol = ...
    val myScenario = scenario("Scenario name").exec(SimulationObj1.random)
    setUp(myScenario.inject(
        rampUsers(10) over (180 seconds)
        )
    )
    .assert(...)
}

class MySimulation2 extends Simulation {
    object SimulationObj2 {
        var feeder = ...
        var random = exec(...)
    }

    val httpProtocol = ...
    val myScenario = scenario("Scenario name").exec(SimulationObj2.random)
    setUp(myScenario.inject(
        rampUsers(15) over (300 seconds)
        )
    )
    .assert(...)
}

And then there's another AllSimulations class that simply calls all the simulations so that the scenarios in them could be executed in parallel.

class AllSimulations extends Simulation {
    object AllSimulationsObj {
        var feeder = ...
        var random = exec(...)
    }

    val httpProtocol = ...
    val myScenario = scenario("All scenarios").exec(
        new MySimulation1().SimulationObj1.random,
        new MySimulation2().SimulationObj2.random)
    setUp(myScenario.inject(
        rampUsers(10) over (180 seconds)
        )
    )
    .assert(...)
}

The problem is that, in order to have different rampUsers count over different durations, I'm removing the setUp block from AllSimulations class, but that gives me an error "No scenario set up".

How do I possibly run all the simulation scenarios in parallel with the rampUsers and durations defined in the respective simulation classes?

EDIT: Here's what I tried, but I'm not sure if it makes sense.

    class AllSimulations extends Simulation {

        setUp(
            new MySimulation1().myScenario.inject(rampUsers(10) over (180 seconds)),
            new MySimulation2().myScenario.inject(rampUsers(15) over (300 seconds))
        )
        .assert(...)
    }
1
I tried this and its working for me - vinilpj

1 Answers

0
votes

I don't think what you propose will work - it doesn't really make sense to execute simulations in parallel as your results would no longer reflect the true number of concurrent users.

What would work would be to define your scenarios (in different files, if that suits), then have a simulation that injects users into each as desired.