jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Luu <manga...@gmail.com>
Subject Re: counter function bug
Date Sun, 09 Oct 2011 04:26:45 GMT
Thanks for the response Deepak. Guess I'll follow your suggestion for the
time being.

If not a bug, then be sad. At least in my opinion, it makes sense to compact
coding and test plan design, having the counter incrementation as part of
the condition. Especially if one treats a while controller like a for(i = 0;
i < count; i++) loop.

FYI, I had the counter as part of the while condition because I intended to
only use and increment it within the while loop but also needed it defined
before or for use in the while condition, so it couldn't be defined
afterwards within the loop, and the original condition: ${__javaScript(
${__counter(TRUE,cnt)} <= 10 )} seemed the most efficient way to do it.

On Fri, Oct 7, 2011 at 4:03 PM, Deepak Shetty <shettyd@gmail.com> wrote:

> 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 <mangaroo@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-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message