I am using Gatling (https://gatling.io) and struggling a bit with the scala (just learning).
I have a feeder which pulls in user data from a csv file:
val feeder = csv("seedfile.csv").circular
And I can happily access values in this file, e.g this allows me login using a value from the 'user_email' column:
exec(http("SubmitLogin")
.post("/auth/login")
.formParam("email", "${user_email}")
The issue Im having is that a range of the columns on my csv file are named item1, item2, item3, etc. I would like to iterate over these items in a loop. I was hoping Scala may have a feature like php $$ vars (http://php.net/manual/en/language.variables.variable.php) so i could do something like:
// actual values pulled from csv file
val item1 = "i'm item 1s val"
val item2 = "i'm item 2s val"
// for i in range
var varname = "item"+i
println(s"${$varname}") //so that for i=1 would be equivalent to println($item1)
Note: I have also tried:
s"$${varname}"
s"${${varname}}"
based on my googling and playing with the repl it appears this is not an option in Scala (which I guess makes sense for statically typed language which encourages immutable data) so any advice on how to approach this the Scala way would be greatly appreciated