it looks to me that the counter gets invoked twice when it is part of the while conditions definition that why you see increment by 2 (which may or may not be a bug) This works Thread Group While controlle r${__javaScript( "${cnt}" != "10" )} +Sampler ${__counter(TRUE,cnt)} --> use this form the time you want the counter increment +sampler ${cnt} anytime within the loop after that
i.e. it looks like the the call to counter must be within the loop , not on the condition regards deepak On Fri, Oct 7, 2011 at 3:52 PM, daluu <manga...@gmail.com> wrote: > I was wondering if what I experience recently is also another counter + > intSum bug or did I set up test incorrectly (I don't think so, but I'm new > to JMeter). Here's a recap from my post about it (original mail to list > with > subject "Counter bug or test plan setup incorrectly?"): > > Hello, > > I'm using counter via variable method than the counter element. But counter > increments by 2 instead of 1 at runtime. Wonder if is bug or if my setup > has > issue. Here's more details > > first HTTP request sampler followed by regex extractor that does global > match (-1), with single group per match ($1$). Then... > > While loop controller with condition of: > > ${__javaScript( ${__counter(TRUE,cnt)} <= 10 )} > > and inside while loop, have samplers that reference the counter (as needed) > like this: > > ${__V(regExMatchVar_${cnt})} > > This works, and loop does end, but remaining issue is that counter is > incrementing by 2 instead of 1, per the docs. Counter does start at 1 > though. > > I get the same "increment by 2" behavior if I substitute counter function > with intSum and a user defined variable "cnt" > > ${__javaScript( ${__intSum(${cnt},1,cnt)} <= 10 )} > > test plan setup: > > test plan > thread group > (user defined vars - if using this method for counter, otherwise, > not exist here) > http request defaults > http sampler > response assertion > regex extractor (matches 1+ matches, we expect 10+) > while loop controller > http sampler 1 > will have more samplers, but I debug/test with one for now > test action with delay of 1 sec > save responses to a file > view results tree > view results in table > aggregate report > > note that some items may be disabled like some of the reporting/view > result options. > > Regards, > > David > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/counter-function-bug-tp4855775p4881586.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > >