Another interference, with foreach controller that followed the http sampler:

I attached a foreach controller, behind the counter incrementing beanshell
postprocessor. The goal is to iterate on "tr" elements of each page, and
send one http request according to each "tr" elements' content.

So if I have 2 pages to go through, and each page contains 50 <tr> elements
I will send 50 http request on each page. 

However when running my scenario I found that my outer while controller's
counter "i" was set to <tr> indexes, and set from 1 to 50. Then I lost again
the second page.

So could anyone explain such intereference between controllers even though
they did not seem to share any variable?


rosiere wrote:
> 
> 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)
> 
> "
> The sampler contained a regex extractor to retrieve and parsed <tr>
> elements on the current page. the extractor matched all occurrences of
> <tr> according to some rules.
> Then the extractor put them into an variable that would represent an array
> and would be used by an embedded foreach controller inside the while
> controller."
> 
> 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-tp702190p26816100.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]

Reply via email to