How to return injection steps from a base class

I have a base class
BaseSimulation extends Simulation

It has one method that attempts to return templated injection steps
def buildModel(modelType: String) = {
modelType match {
case “open”
var model = (rampUsersPerSec(1) to 10 during (1 minutes))
case “closed”
var model = (constantConcurrentUsers(10) during (10 seconds))

I have a derived class
MySimulation extends BaseSimulation

It trys to get the model
var model = super.buildModel(“open”)

And call

This throws the error
could not find implicit value for evidence parameter of type io.gatling.core.controller.inject.InjectionProfileFactory[Any].inject(model)

Is there a way to make this work? I really don’t want all of my simulations to have to deal with implementing match code to select objects like below.
object OpenModel {


object ClosedModel {


That cannot work.
Open and closed injection model steps are incompatible types so you can’t mix them, hence they don’t have a common super type that is accepted by inject().
You’ll have to design a different way.

Stéphane Landelle

GatlingCorp CTO