In your example you are concatenating ${rid}${my_var}
But I want to add those two values
if ${rid} = 5 and ${my_var} = 2 the result should be 7, but now is 52.
Well, as I don’t know where your rid value comes from…
If it comes from a CSV, yes, it’s a String, so you have to convert it to a String:
session.getTypedAttribute[String(“rid”).toInt + myGlobalVar.getAndIncrement)
JsonPath currently extract as String, the "rid" attribute in the Session is
indeed a String. Seems complicated to change that, but I will give it a
thought.
Regarding the result you get, the problem is on your side, the code I sent
you is definitively correct and sums two Ints.
Moreover, with your example, if newRid is 1 and "rid" is 134, if the code
was concatenating String (which it doesn't), you would get 1134, not 1341.
My 2 cents is that you didn't change what you're passing to fileBody, like
I wrote previously.
I am working on my code with the help of this post.
I am trying to make “token” variable below globally accessible (I do not want to increment it)
Error I get is “value setAttribute is not a member of io.gatling.core.session.Session”
Can you please guide me to resolve this.
val myGlobalVar = new java.util.concurrent.atomic.AtomicInteger(0)
It’s my first time with gatling . I have a doubt regarding the declaration of a variable and I think you could help me.
I have programmed a loop and have created a variable (‘iteration’) that should be incremented in one unit in each iteration. However, I am getting the initial value in every iteration.
I have already read the gatling documentation and the answers of this group. The suggested solution is to get the Session id in each iteration. However, this doesn’t function in our case. Why? Because we need this variable to be an integer not a string. Thank you!