use the counter name as Integer inside repeat block

Hi,

I am trying to do something like this

function doThat(int n) {…}

for (int i=0; i<max; i++)

doThat(i)

In one of my many attempts, I tried

`

val somevalue = 10

def doThat( n : Int ) = exec(ws(“step”").sendText("""{“abc”:""" +(n*somevalue)+ “}”)

val scn = scenario(…)

.repeat(10, “step”) {

exec( session => {

doThat(session(“step”).as[Int]);

session

}

)
`

This doesn’t complain when running, but the other end does not receive anything. I’m not sure if nested exec is ok. Removing the exec in def gets me to the same point. If I call “doThat” outside the session block, then the server gets the messages but how can I then access the counter as an Integer ?

Hints anyone?

Thanks

No, the nested exec does not work. Look at the built-in looping constructs. How can you construct that using Gatling DSL?