Hi everyone,
I am trying to create a generic velocity tests for API’s using Gatling.
I want to pass in a string of endpoints to hit and exec each one of these for a scenario
i.e. `/api/dostuff#/api/do/otherstuff’
I can access the string in the file easily but cannot work out how to dynamically create the scenario
`
val endpoints = System.getProperty(“bendpoints”).split(“#”);
val scn = scenario(endpoints.mkString(“”))
for (e ← endpoints) {
exec(scenario(endpoints.mkString(“”))
.exec(http(“http”)
.get(e)))
}
`
And get the following as an error.
java.lang.IllegalArgumentException: requirement failed: Scenario /api/c/Keyword/blue/api/cc/keyword/red is empty
at scala.Predef$.require(Predef.scala:277)
at io.gatling.core.scenario.Simulation.$anonfun$params$4(Simulation.scala:134)
at io.gatling.core.scenario.Simulation.$anonfun$params$4$adapted(Simulation.scala:134)
at scala.collection.immutable.List.foreach(List.scala:388)
at io.gatling.core.scenario.Simulation.params(Simulation.scala:134)
at io.gatling.app.Runner.run0(Runner.scala:77)
at io.gatling.app.Runner.run(Runner.scala:61)
at io.gatling.app.Gatling$.start(Gatling.scala:74)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)
at io.gatling.app.Gatling$.main(Gatling.scala:39)
at io.gatling.app.Gatling.main(Gatling.scala)
I think i have the for correct but i don’t know if this is the best way to do this or if the expression is correct.
From what i can tell you cant add extra ‘exec’ steps to a scenario after it is created.
I only dip into Java + Scala when doing creating Gatling scripts which isn’t very often so any hep will be greatly appreciated.
Regards,
Aaron.