AtomicInteger() and String Interpolation

Hi,

I am trying to increment a value using AtomicInteger() and string interpolation.

https://github.com/BBC/gatling-load-tests/blob/master/src/test/scala/bbc/bbcid/Oauth.scala#L22

https://github.com/BBC/gatling-load-tests/blob/master/src/test/scala/bbc/bbcid/Oauth.scala#L26

However, the integer is always ‘0’ and I wondered if I was wrongly mixing Scala and EL?

Many Thanks

Adrian

I don’t think you can change values like that. The easiest way is create a string before request and set it as session variable.

String interpolation is not a function, it’s a macro (see it as a sugar for an implicit StringBuilder that gets appended).
You still have to wrap everything into a function if you want something to be resolved every time. See Expression documentation.

BTW, make you AtomicInteger a val, not a var!