On 12/02/2009, Noel O'Brien <[email protected]> wrote:
> Hi All,
>
>  Is it possible to reset a counter preprocessor? I've been pulling my hair out
>  about it all morning.
>
>  I've got a For Each controller which contain a Simple controller and a Loop
>  controller respectively. The loop controller contains a Counter, which I
>  would like to reset each time the For Each controller iterates. I've tried
>  resetting the variable that the counter writes to ('count') but it appears
>  the count index is maintained in the Counter element, and over-writes any
>  value I've set in the 'count' variable.

Yes, the count is maintained by the element which overwrites the
variable each time.

>  I've worked around the problem by implementing a "My Counter" Beanshell
>  Preprocessor that I've put in the Loop controller and a "Reset Counter"
>  Beanshell Postprocessor in the Simple controller. While my solution works,
>  I'd prefer to stick to build-in modules for this kind of thing, otherwise
>  maintaining test plans becomes more difficult and error-prone.
>
>  Does anyone know of a more elegant solution? Maybe the Counter element could
>  be modified to allow it to be reset?

The counter element already does reset the count. This is done when
the iterationStart() method is called. This should occur on the first
iteration of any parent loop, but there may be some controllers that
don't implement this correctly.

I don't think it would be easy to allow the Counter to be reset.
Would it be a separate test element? If so, how is the target counter
to be identified?

If the counter value were stored in a JMeter variable, that would be
slower as the variable would have to be fetched each time, and anyway
it would not work for the global counter option.

The __intSum() and __longSum() functions can be used to generate a
sequence; just use the User Parameters Pre-Processor to intialise the
variable.

>  Regards,
>  Noel
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [email protected]
>  For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to