You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jacqui Guerrero <jg...@purisma.com> on 2004/04/28 23:22:28 UTC

While loop functionality

Is there a way to simulate a while loop in the test plan?  I need a way
to repeat the same HTTP request until a certain string is displayed on
the page, for example:

 

Test Plan

      |

     Thread Group

         |

        MatchTest

          |

         /pages/login.jsp

         /pages/j_security_check

        /pages/main.do

        /pages/top.jsp

        /pages/test.tst

        /pages/taskList.do   <- I need to repeat this step until "Done"
is displayed on the page then move to next step

       /pages/logout.do

 

 

Has anyone ever tried to do something similar?

 

Thanks,

Jacqui


Re: While loop functionality

Posted by peter lin <jm...@yahoo.com>.
 
I like to think of it as sleep deprevation exercize. SWT looks nicer and is fast.  Since most of jmeter developers use eclipse, it would be way too cool.
 
now I just have to figure out exactly how many hours of sleep I can survive on. 5 hrs seems to be my limit right now :)  The only downside of writing an eclipse plugin for me is I'd probably direct all my jmeter work to the plugin and probably wouldn't entertain new features until after the eclipse plugin was working.
 
peter


Thad Smith <th...@yahoo.com> wrote:

Note: The above scenario only works with the current
code in the nightly build.

Regards,

Thad Smith

P.S. There has been talk of creating some eclipse
plugins that allows you to run JMeter inside of a Java
program in eclipse, but nothing has been done yet.


		
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 

Re: While loop functionality

Posted by Thad Smith <th...@yahoo.com>.
Actually there is a way to do this.

I've made some modifications to the ForLoop controller
to allow it to use a JMeter variable as a loop
counter. What you do is initialize a JMeter variable
to 1...and use that JMeter variable as the loop
counter. If you want to loop again then increment the
counter variable and you'll loop again.

Your test tree would look something like:

Test Plan

      |

     Thread Group

         |

        MatchTest

          |

         User Parameters
           i=1

         /pages/login.jsp

         /pages/j_security_check

        /pages/main.do

        /pages/top.jsp

        /pages/test.tst

         LoopController 
           Loop Count: ${i}

           |
 
           /pages/taskList.do

               |

               Regular Expression Extractor
                 Reference Name: done
                 Regular Expression: Done
                 Template: true
                 Match No: 1
                 Default Value: false

           If Controller
             Condition: !${done}

                |

                User Parameters
                   i=${__javaScript(${i}+1,)}

                Test Action
                   Target: Current Thread
                   Action: Pause
                   Duration: 0

       /pages/logout.do

Basically, what's happening here is that you are going
to execute the /pages/taskList.do http request at
least once. If the text Done is found than the JMeter
varible ${done} is set to true, else false. The If
Controller is a child of the Loop Controller and
increments the value of ${i} if !${done} is true (the
text "Done" wasn't found). You have to stick the Test
Action in the if controller because the controller
won't execute at all if it doesn't have a sampler to
sample. 

Test Action is a new Sampler that I added a few weeks
ago that will either pause or stop the current thread
or the entire test based on how you set it up. It's a
sampler because that was the only way to introduce
this functionality without completely rewriting
JMeter. Plus, I think it's pretty convenient for use
in the above scenario...It basically pauses the test
for 0 milliseconds. The Test Action sampler doesn't
actually return a sample. You can use any other
sampler in its place for that matter.

Note: The above scenario only works with the current
code in the nightly build.

Regards,

Thad Smith

P.S. There has been talk of creating some eclipse
plugins that allows you to run JMeter inside of a Java
program in eclipse, but nothing has been done yet.

--- Hans Then <h....@wanadoo.nl> wrote:
> Jordi Salvat i Alabart wrote:
> 
> > Not currently.
> >
> > Jacqui Guerrero wrote:
> >
> >> Is there a way to simulate a while loop in the
> test plan?  
> >
> More generally, is there a way to create the test
> plan in a programming 
> language? Is it possible to call the Java objects
> that execute the test 
> plan directly from a Java program. The functionality
> I am looking for is 
> somewhat like HttpUnit, but with the focus on
> load-testing, so I also 
> need the stress-engine and the reporting facilities.
> This would make 
> simulating complex user interactions less difficult
> than it is using 
> only a GUI.
> 
> Hans Then
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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


Re: While loop functionality

Posted by Hans Then <h....@wanadoo.nl>.
Jordi Salvat i Alabart wrote:

> Not currently.
>
> Jacqui Guerrero wrote:
>
>> Is there a way to simulate a while loop in the test plan?  
>
More generally, is there a way to create the test plan in a programming 
language? Is it possible to call the Java objects that execute the test 
plan directly from a Java program. The functionality I am looking for is 
somewhat like HttpUnit, but with the focus on load-testing, so I also 
need the stress-engine and the reporting facilities. This would make 
simulating complex user interactions less difficult than it is using 
only a GUI.

Hans Then

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


Re: While loop functionality

Posted by Jordi Salvat i Alabart <js...@atg.com>.
Not currently.

Jacqui Guerrero wrote:
> Is there a way to simulate a while loop in the test plan?  I need a way
> to repeat the same HTTP request until a certain string is displayed on
> the page, for example:
> 
>  
> 
> Test Plan
> 
>       |
> 
>      Thread Group
> 
>          |
> 
>         MatchTest
> 
>           |
> 
>          /pages/login.jsp
> 
>          /pages/j_security_check
> 
>         /pages/main.do
> 
>         /pages/top.jsp
> 
>         /pages/test.tst
> 
>         /pages/taskList.do   <- I need to repeat this step until "Done"
> is displayed on the page then move to next step
> 
>        /pages/logout.do
> 
>  
> 
>  
> 
> Has anyone ever tried to do something similar?
> 
>  
> 
> Thanks,
> 
> Jacqui
> 
> 

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