Passing name of SCN to run in simulation

Hi Team

I would like to know if there is a way , to passe as JVM parameter a name of scn to run in setup

For example if in my Simulation i have scn01 to scn05 and i want to run a setup like below but depending of a situation i need to change wich scenario to run before another

setUp(
      SCN**XX**.inject( atOnceUsers(10))
				 .andThen( SCN**YY**.inject(atOnceUsers(1)
      ))
		).protocols(httpProtocol)

i tried using : val SCNXX= System.getProperty(“myscenario”) , where i will pass -D= but Gatling doest not like it

Thanks in advance
Regards
Corrine

It’s a matter of programming language. In Scala/Java/Kotlin, the String name of a variable is not the variable itself.

val scenario1 = ???
val scenario2 = ???

val scenarioName = System.getProperty("myscenario")
val scenario = scenarioName match {
  case "scenario1" => scenario1
  case "scenario2" => scenario2
}

setUp(
      scenario.inject( atOnceUsers(10))
				 .andThen( SCN**YY**.inject(atOnceUsers(1)
      ))
		).protocols(httpProtocol)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.