On Fri, 2008-11-28 at 12:13 +0000, sebb wrote:
> On 28/11/2008, Hiro Protagonist <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> >  I am currently stuck with the following:
> >  I have a web application that uses AJAX to display information coming
> >  from a database in portlets (graphical representation). These portlets
> >  each trigger a set of SQL queries in a database, and while the database
> >  is getting the query result, an animated GIF is displayed, and
> >  Javascript causes the browser to poll every 5 seconds or so, until the
> >  'real' information can be displayed, at which point the polls stop.
> >  This is an isue with JMeter, because as far as JMeter is concerned, the
> >  request that was sent has been answered, and it moves on to the next
> >  request.
> >  However, what I need is essentially a loop that keeps checking what the
> >  contents of the response is, and repeat the http request until the word
> >  'Sarching' does not appear anymore (meaning in received data to be
> >  displayed in the portlet).
> >  There are a number of different portlets on each page, identified by a
> >  unique string in the previous http response, which is used in the
> >  'polling request' that is sent back to the server.
> >  I have managed to get this far:
> >
> >  - set up a regex that extracts the unique ID for each portlet
> >  - set up a for_each loop that goes through all of these IDs and sends
> >  requests
> >  - set up a regex that extracts the response from the polled request
> >
> >  However, the problem I have is that the while loop, which is nested
> >  inside the for_each loop, never moves on to the second value after the
> >  first response has finished and found the response.
> >
> >  Here is my test plan:
> >
> >
> >  *** (various login and authentication requests)
> >  |
> >  @Regex called 'searching' with default value of 'NOTFINISHED'
> >  |
> >  *Request to move to page containing portlets (regex 'searching')
> >  |
> >  #For Each Controller (iterates all values for request/response above)
> >  \
> >   \
> >   #While controller (loop while regex defaults to 'NOTFINISHED')
> >    |
> >    * Request for portlet
> >     \
> >      @Regex searching looking for 'searching' in response.
> >       If not found, default value is NOTFINISHED
> >
> >  Everything works, except that I get stuck in the while loop after the
> >  first portlet comes back without 'searching' - effectively having found
> >  the information and it should then set the regex to something else.
> >  What is wrong with this setup ?
> 
> Difficult to say, as you don't show what the While Condition is.

I have set the while condition to:
${__javaScript( ${SEARCHING}=="NOTFINISHED",dummy)}

sebb, also I believe there may be a problem with variable scope here. To
enter the loop, the while controller needs the variable SEARCHING to
exist before (which it does). The regex attached to the HTTP request
inside the while loop re-references this name (SEARCHING), but sets a
default value of "FINISHED" if the string was not found. It seems that
this setting never actually takes place - I have placed a debug sampler
inside the loop and even though the value of SEARCHING is set to
'FINISHED' after the regex term was not found, it keeps looping.

> 
> Try adding Debug Sampler(s) and look at the variables in View Results Tree.
> 
> >  Should I be using a user-defined variable instead of a regex ?
> 
> I don't understand. The regex output is stored in a variable.
> 
> >  Thanks for your help !
> >  hiro
> >
> >
> >  ---------------------------------------------------------------------
> >  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]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to