You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jim Donnellan <jd...@highergear.com> on 2007/02/14 01:24:55 UTC

Question about nesting loops

Let me come at this form a different angle...

I have a single thread group that is running N loops. Inside it has one 
If Controller that is working quite well. If I simply put a sampler 
under the If, things go as expected. The If uses the Math.random() < .3  
to run nearly, but not exactly, 30% of the time at random intervals.

What I want is that if the If condition is met, the sample will be run X 
times, then we continue through the thread group, and if there are more 
loops of the thread group
to run, loop through the thread group again.

I've tried this, where "Yo" and "Hello" are just Java samplers...

THREAD GROUP  L=20
|
|- IF CONTROLLER ~30 %
         |
         | -  "Yo"
         |
         |- LOOP CONTROLLER  = 5
                    |
                    |-- "hello"
 

This is what I get in terms of Yo's and Hello's  (Y and H):
Y Y H H Y Y Y H Y Y

I also tried using a simple controller to group everything under the IF, 
a la

THREAD GROUP    L=20
|
|- IF CONTROLLER ~30 %
         |
         |-- SIMPLE
                  | -  "Yo"
                  |
                  |- LOOP CONTROLLER = 5
                             |
                             |-- "hello"


And got this in the results tree:
 Y H H H H H Y H   then  no more

The first group looks good (5 Hellos for each Yo).  But that second one 
only has one Hello, which isn't what I want.


What am I missing here?


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question about nesting loops

Posted by Jim Donnellan <jd...@highergear.com>.
Bug filed: http://issues.apache.org/bugzilla/show_bug.cgi?id=41612

Jim Donnellan wrote:
> Let me come at this form a different angle...
>
> I have a single thread group that is running N loops. Inside it has 
> one If Controller that is working quite well. If I simply put a 
> sampler under the If, things go as expected. The If uses the 
> Math.random() < .3  to run nearly, but not exactly, 30% of the time at 
> random intervals.
>
> What I want is that if the If condition is met, the sample will be run 
> X times, then we continue through the thread group, and if there are 
> more loops of the thread group
> to run, loop through the thread group again.
>
> I've tried this, where "Yo" and "Hello" are just Java samplers...
>
> THREAD GROUP  L=20
> |
> |- IF CONTROLLER ~30 %
>         |
>         | -  "Yo"
>         |
>         |- LOOP CONTROLLER  = 5
>                    |
>                    |-- "hello"
>
>
> This is what I get in terms of Yo's and Hello's  (Y and H):
> Y Y H H Y Y Y H Y Y
>
> I also tried using a simple controller to group everything under the 
> IF, a la
>
> THREAD GROUP    L=20
> |
> |- IF CONTROLLER ~30 %
>         |
>         |-- SIMPLE
>                  | -  "Yo"
>                  |
>                  |- LOOP CONTROLLER = 5
>                             |
>                             |-- "hello"
>
>
> And got this in the results tree:
> Y H H H H H Y H   then  no more
>
> The first group looks good (5 Hellos for each Yo).  But that second 
> one only has one Hello, which isn't what I want.
>
>
> What am I missing here?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org