You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Charles Lin (charlin)" <ch...@cisco.com> on 2016/01/29 11:03:29 UTC
how to wait on a HTTP request while waiting for response content to
change
Hi experts,
I have an HTTP request which is submitted to server, and I need to wait on this request for the response content to contain some critical value that I need to extract and use in subsequent HTTP requests.
For example, when the HTTP request is submitted, initially I might get something like
window.parent.func_prepare('Preparing',' ....
But after server completes processing of the request and data has become available, then the Response content (to the above same HTTP request) will contain something like this:
window.parent.func_prepare('OKOK',' ....
So I have a RegEx Extractor trying to extract some string that is part of the 'good' response, which is the one with ('OKOK', .... Plus critical value I want to extract)
But depending on the processing delay on the server backend, this request will fail to obtain the desired RegEx extraction, because it cannot find any RegEx match in the 'bad' response, which is the one with ('Preparing','...... stuff that does not contain the data I need)
I have set up HTTP request as follows:
HTTP Sampler
->Constant Timer
->RegEx Extractor (for variable1)
->Assertion (for existence of 'OKOK' and other strings based on RegEx match)
->RegEx Extractor (for variable2)
First of all, I don't think the Constant Timer is working, since I can tell that execution just move on even if I set a large timer value.
But also, instead of simple (dumb) timer, perhaps I should use some more advance logic, like if response contains 'Preparing', then wait for response to change, until I see 'OKOK' in response, or after some timeout is reached.
But I am not sure how to construction that logic around this HTTP Sampler.
Any help is greatly appreciated.
Regards,
Charles
Re: how to wait on a HTTP request while waiting for response content
to change
Posted by UBIK LOAD PACK Support <su...@ubikloadpack.com>.
On Fri, Jan 29, 2016 at 11:03 AM, Charles Lin (charlin) <ch...@cisco.com>
wrote:
> Hi experts,
>
> I have an HTTP request which is submitted to server, and I need to wait on
> this request for the response content to contain some critical value that I
> need to extract and use in subsequent HTTP requests.
>
> For example, when the HTTP request is submitted, initially I might get
> something like
>
> window.parent.func_prepare('Preparing',' ....
>
> But after server completes processing of the request and data has become
> available, then the Response content (to the above same HTTP request) will
> contain something like this:
>
> window.parent.func_prepare('OKOK',' ....
>
> So I have a RegEx Extractor trying to extract some string that is part of
> the 'good' response, which is the one with ('OKOK', .... Plus critical
> value I want to extract)
>
> But depending on the processing delay on the server backend, this request
> will fail to obtain the desired RegEx extraction, because it cannot find
> any RegEx match in the 'bad' response, which is the one with
> ('Preparing','...... stuff that does not contain the data I need)
>
> I have set up HTTP request as follows:
>
> HTTP Sampler
> ->Constant Timer
> ->RegEx Extractor (for variable1)
> ->Assertion (for existence of 'OKOK' and
> other strings based on RegEx match)
> ->RegEx Extractor (for variable2)
>
> First of all, I don't think the Constant Timer is working, since I can
> tell that execution just move on even if I set a large timer value.
>
No that's not how Timer and Post Processor will work:
http://jmeter.apache.org/usermanual/component_reference.html#timers
http://jmeter.apache.org/usermanual/component_reference.html#postprocessors
>
> But also, instead of simple (dumb) timer, perhaps I should use some more
> advance logic, like if response contains 'Preparing', then wait for
> response to change, until I see 'OKOK' in response, or after some timeout
> is reached.
>
>
> But I am not sure how to construction that logic around this HTTP Sampler.
>
This answer contains what you need:
-
http://stackoverflow.com/questions/12238409/how-to-make-jmeter-wait-for-a-page-answer
>
> Any help is greatly appreciated.
>
> Regards,
> Charles
>
>
>
--
Regards
Ubik Load Pack <http://ubikloadpack.com> Team
Follow us on Twitter <http://twitter.com/ubikloadpack>
Cordialement
L'équipe Ubik Load Pack <http://ubikloadpack.com>
Suivez-nous sur Twitter <http://twitter.com/ubikloadpack>