Hello
I’m trying to run foreach on multiple records of feeder but foreach is not executing and no errors are shown
scenario("my scenario")
.feed(myFeeder, 5) //read 5 lines as array?
.foreach("#{columnName}", "attrName") { session => //iterate over array
println(session("attrName").as[String])
session
}
But if i change code to repeat, everything works (so file could be read)
scenario("my scenario")
.repeat(5) { // read 5 lines one by one
feed(myFeeder)
.exec { session =>
println(session("columnName").as[String])
session
}
}
With gatling v 3.7.6 i can see keys in session like “columnName1”, “columnName2”, etc…
With gatling 3.9.1 or higher i can see key “columnName” but i don’t know its type so i cant do anything with it.
Thank you for your reply, i’ve missed exec block when copied an example. My project compiles and runs but foreach don’t iterate over records of csv file.
Make sure to upgrade to the latest version (3.9.5 atm).
If you still experience an issue, please build a simple yet complete reproducer someone else can run on his side.
Condition evaluation crashed with message ‘Can’t cast ‘[Ljava.lang.Object;@7cafc344’ of type class [Ljava.lang.Object; into interface scala.collection.immutable.Seq’, exiting loop
Yes, but putting objects from object array to ArrayList looks like a workaround. When working with api (gatling) expecting things to work without this step.
Like reading lines and storing them directly in Seq or ArrayList not in Object