5
votes

Spent a lot of time investigating it but found that Counter element in my Jmeter testplan is initialized only once. The case:

I have a ForEach controller with Counter as a child. Counter Max value is defined with variable. I expect that this counter's max value will be reinitialized on every loop. But it's not true. Counter's max is installed once, and will not be changed anymore in other loops.

Of course, I can easily implement the same functionality using BeanShell Sampler (and that's how I do now). But my question is: is there any way to reinitialize counter's max value without scripting?

1
I think rather max value is reinitialized every time the counter reaches maximum. I.e. say max=10, you run, 0, 1, 2, 3, 4, 5, then at 6 you change max to 20. Counter will keep increasing to 10, then will reset itself to 0, at which point its max will become 20. - Kiril S.
Kiril, thanks for your answer. No, it doesn't reinitialize on max reaching. Tried it. - Konstantin Dobroliubov
I think it is by design... - Ray Oei

1 Answers

0
votes

Counter max value is effectively read each time counter is executed.

So if you find it is not, then most probably the problem is in the update of max value.

You can add a Debug Sampler after settings this value to check the value of variables and use a View Results Tree to see the values.