jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thad Smith <>
Subject Re: While loop functionality
Date Thu, 29 Apr 2004 19:23:17 GMT
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




         User Parameters






           Loop Count: ${i}



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

           If Controller
             Condition: !${done}


                User Parameters

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


Basically, what's happening here is that you are going
to execute the /pages/ 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

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.


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 <> 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:
> For additional commands, e-mail:

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message