Dynamically Select Injection Profile for Simulation

Hello :slight_smile:

Being new to Gatling and Scala, I am facing the following challenge.

I have a base class called ParameterizedSimulation which is being extended by all of my Simulations. Its goal is to provide some parameters to my tests coming from different places. The code is the following:

class ParameterizedSimulation extends Simulation {
 // Workload model parameters
 def injectionProfile: String = getProperty("INJECTION_PROFILE", "smoke")

 private def getProperty(propertyName: String, defaultValue: String): String = {

In addition to that, I have an object containing low-level methods (i.e. user actions) that I use in my Simulations. The code is like the following:

object UserAction {
 def echo(): HttpRequestBuilder = {
  http("Postman Echo Service Call")

Hi there,

It doesn’t make any sense to mix closed and open workload steps.
As a consequence, they don’t share a common super type.

You should pass the scenario to your dynamicInjectionProfile method and return the result of the inject method.

Hello Stéphane,

Thanks for the quick response.

I did it as you suggested.