jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: while and xpath extraction
Date Fri, 05 Sep 2008 11:41:36 GMT
On 05/09/2008, James Hill <everywherenet.jm@gmail.com> wrote:
> Hi all.
>
>  I'm pretty sure this can be done - it rings a bell anyway from past jmeter
>  threads - but for the life of me I can't find any reference to it.
>
>  I'm sending a SOAP request that causes the server to kick off an
>  asynchronous job. The next step is a request to retrieve some data based on
>  this response - send the request too early and the response doesn't contain
>  the data required for the xpath extractor that's a part of this retrieve
>  request. The most inelegant solution is the one currently employed - we put
>  in a constant timer that waits for the maximum time we've seen (through
>  trial and error) and then steps into the next request. Invariably it grabs
>  the right data, but the asynchronous job doesn't always take this long. In
>  fact sometimes it can be quite quick so for 20 of the 25 seconds the load
>  server is sitting there doing not much at all.
>
>  I'd like to use an XPath Extractor to pick out the incorrect response each
>  time the request is sent and embed this in a while controller. As soon as
>  the response is the valid one we're looking for, the while loop exits and
>  the test moves on to the next step.
>
>  Can this be done and if so how?

The While Controller exits when its condition evaluates to the string
"false", so you just need to define a variable (or function) that is
initially not "false", but evaluates to "false" at the appropriate
time.

If you set the default value to "false", and arrange the XPath
Extractor so it matches incorrect responses only, then this should do
the trick.

If it's tricky to generate the appropriate negative XPath expression,
then look for the success indicator, and use javascript/jexl/beanshell
to convert the variable to false, i.e. the script function condition
would need to be something like

"${XPATHVAR}" == "default"

or equally

"${XPATHVAR}" != "success"

where "default" is the XPATH default value and "success" is the value
returned for a successful response.

>  Regards,
>
> James.
>

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


Mime
View raw message