Unanswered question

Is it possible to increment a variable with loop iteration ?

Hi,
I use Neoload v4.1.3 and I have got the following behavior:
I add a loop in my recording and inside that loop, I use variables that I want to increment with each loop iteration.
Unfortunately, for each loop iteration, variable is reset. Value of variable <LoopName>_counter still equals 1, for each loop iteration.

So my question is: is it possible to increment a variable with loop iteration ?

Patrick G.
Patrick G.

Patrick G.

Level
0
2 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

Normally, the <LoopName>_counter should contain the right loop iteration number. I don't see how it could be reset to one each time. Do you have some screen shots showing us that behavior?

 

Frank L.
Frank L.

Frank L.

Level
0
53 / 100
points

Before your loop, Add JS Script and define a variable like below:

context.variableManager.setValue("VariableName",VariableValue);

in the loop, use below js script to increase your Variable
//Get the Value of Variable
var myVal = context.variableManager.getValue("VariableName");

// Change the Value of Variable
var myVal = paserInt(myVal )+1
context.variableManager.setValue("VariableName",myVal );

welcome any feedback