Unable to get attributeName in a foreach loop

hello any help with this would be awesome!

What I am trying to achieve is the following:

I am setting the following in session:

var rulesetUids:Seq[String] = Seq()

.exec(session => session.set(“rulesetsTest”, rulesetUids))

which creates the following list in session - see below two string values

rulesetsTest → List(5fdbaa99-1ae9-4507-a1e7-7394df90e1ad, d80eac04-9371-4d20-b55c-10fff6ed50c2)

I then have the following forEach loop. But the string interpolation is not working on "${ruleset} or ${counter}??

.foreach("${rulesetsTest}", “ruleset”, “counter”) {
TestUtil.putRuleset2("${ruleset}", rulesetFilePath, “${counter}”).pause(2) // this is a HTTP PUT request but I need the rulesetName from the list. This

What is wrong with this code above??

NOTE: If I run this with a print statement I see it is looping correctly

.foreach("${rulesetsTest}", “ruleset”, “counter”) {
exec {
session => {

It will print correctly as → 5fdbaa99-1ae9-4507-a1e7-7394df90e1ad and then d80eac04-9371-4d20-b55c-10fff6ed50c2 .

But I try to print “${ruleset}” the string is NOT replaced. It is displayed as “${ruleset}”

any suggestions on how to do?



First, don’t use “session.attributes”, use the correct API: https://gatling.io/docs/gatling/reference/current/session/session_api/

And then, you can’t use Gatling Expression Language in session functions, also as explained in the doc: https://gatling.io/docs/gatling/reference/current/session/expression_el/

Now, we’re playing riddles, as you don’t provide any clue about what TestUtil.putRuleset2 does.
First try to build simple things and provide a full sample.

oh ok I think I misread https://gatling.io/docs/gatling/reference/current/session/session_api/ thanks!