Hi Team,
I wanted to save the for each attribute name to the variable. I tried below and it did not work. can someone please help on this?
foreach("${list}", “Number”) {
.
.
.
.
.
val containerNum = "${Number}"
println(“container Number=”+containerNum)
}
the straight assignment of “${Number}” to a scala var isn’t going to work - to scala, ${Number} is just a string literal.
You’re going to need to use a session action to get the value form the gatling session.
so somewhere in your foreach loop
.exec(session => {
println(s""“container Number=${session(“Number”).as[String]}”"")
session
})