Another interference, with foreach controller that followed the http sampler:
postprocessor. The goal is to iterate on "tr" elements of each page, and
send one http request according to each "tr" elements' content.
I will send 50 http request on each page.
counter "i" was set to <tr> indexes, and set from 1 to 50. Then I lost again
the second page.
Post by rosiereHello,
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).
${__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
${__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".
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.
Post by sebbSee
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
Post by Anton AndreevHello 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
---------------------------------------------------------------------
---------------------------------------------------------------------