Hello,
I'm also facing problems with while controller, especially with its loop
counter and an embedded foreach controller.
I would like to go through a list of paginated result (like google's search
result), and use a regex to parse every page.
So I first parsed the list page and found the greatest page number (say 2).
Then I defined a while controller with this condition:
${__javaScript( ${i} < ${numPageMaxi} )} (i is a predefined user variable,
initialized to 0)
Then, inside my while controller, I identified HTTP request's format
(parameter) needed to view each page (for example, page 1 needs 0, 50 ;
page 2 needs 50, 100 , and so on ) and I created an HTTP request sampler
with these 2 parameters:
${__javaScript(${i} * 50)} (for lower bound)
${__javaScript(${i} *50 + 50)} (for upper bound)
After the sampler I created a Debug Sampler to view the variables, including
my counter "i".
Afther the debug sampler, I used a BeanShell PostProcessor to increment i:
String i = vars.get("i");
int counter = Integer.parseInt(i);
counter++;
vars.put("i", "" + counter);
My problem is that the http request sampler (that took upperbound and
lowerbound computed from iteration counter i)ran only once with upperbound
to 50 and lowerbound to 0, instead of twice even though I did get the total
number of pages (2) and my PostProcessor ran twice.
In order to fully iterate the pages I had to disable the Debug Sampler
behind the http sampler.
Could you please tell me why my debug sampler interferes with other samplers
and the iteration counter?
Thanks.
sebb-2-2 wrote:
>
> See
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#While_Controller
>
> The While Controller condition needs to return the string "FALSE" or
> "false" in order to exit the loop.
>
> ${counter}<3
>
> will never be "false"
>
> it will be perhaps "0<3" or "1<3" or "100<3" etc
>
> "You need to use a Javascript or Beanshell function to evaluate the
> string as an expression."
>
> S
> On 24/08/05, Anton Andreev <[email protected]> wrote:
>> Hello everybody,
>>
>> I'm trying to set up a counter to be used with while
>> controller and i'm having dificulty (my while loop
>> does not stop). What i did, just before while
>> controller i have "user variables" where i set
>> {counter} to 0. In while controller my condition is
>> ${counter}<3 and i have counter (name {counter}, just
>> like user var) inside the loop which starts from 1 and
>> increments by 1 till 4. My while loop does not stop.
>> Please tell me what i'm doing wrong or if i have to
>> use something else to accomplish what i'm trying to
>> do.
>>
>> Thank you,
>>
>> Anton Andreev
>>
>>
>>
>>
>>
>>
>> __________________________________________________________
>> Find your next car at http://autos.yahoo.ca
>>
>> ---------------------------------------------------------------------
>> 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]
>
>
>
--
View this message in context:
http://old.nabble.com/using-counter-with-while-controller-tp702190p26815923.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]