You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by rxfillpharm <rx...@yahoo.com.INVALID> on 2014/07/24 17:32:32 UTC
Replace hardcoded request param with new value generated at runtime?
Cheers,
In the web app I am testing, a unique authorization code is generated at runtime and submitted with each http request during that [web browser] session. Jmeter script recorder stores the hardcoded value, which again is only valid during that session.
I can use the Regular Expression Extractor to capture the authorization code ${AuthCode}, which is generated on the 10th http request in the test plan. I need to tell JMETER to use this new authorization code in all subsequent http requests in the test. I can manually replace all subsequent occurrences of the code with the new value extracted ${AuthCode}, but this would mean hundreds of manual changes.
Is there any way to tell JMETER that from a given point going forward, ignore the hardcoded value of the http request parameter and use the value extracted at the 10th call. This is important because each test plan has hundreds of calls and there will be multiple test plans for the web site.
THX... BTW Joined today and this is my first post here. Hope I'm doing this correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Replace hardcoded request param with new value generated at runtime?
Posted by rxfillpharm <rx...@yahoo.com.INVALID>.
Great. Find and Replace worked. I will try the other solution as well. Thank you.
--------------------------------------------
On Thu, 7/24/14, Deepak Shetty <sh...@gmail.com> wrote:
Subject: Re: Replace hardcoded request param with new value generated at runtime?
To: "JMeter Users List" <us...@jmeter.apache.org>
Date: Thursday, July 24, 2014, 11:58 AM
Hi
the
recorded script is a text file (the .jmx) and it is trivial
to do a
find and replace (as opposed to but
this would mean hundreds of manual
changes.)
However there probably is another way
http://jmeter.apache.org/usermanual/best-practices.html
-- 16.5 Using the
HTTP(S) Test Script
Recorder
* One of the most useful features
of the HTTP(S) Test Script Recorder is
that
you can abstract out certain common elements from the
recorded
samples. By defining some
user-defined variables
<http://jmeter.apache.org/usermanual/functions.html>
at the Test Plan level
or in User Defined
Variables
<http://jmeter.apache.org/usermanual/component_reference.html#User_Defined_Variables>
elements, you can have JMeter automatically
replace values in you recorded
samples*
Because your value is not
predetermined you either have to be able to use a
regex (not sure it works)
or
pause your test - i.e. when you reach the step where the
auth code is
generated , stop the recording
proxy, note down the value , put it into the
value of the user defined variable then restart
the recording proxy and
your test should
replace all other occurrences with the defined variable
name.
regards
deepak
On
Thu, Jul 24, 2014 at 8:32 AM, rxfillpharm <rx...@yahoo.com.invalid>
wrote:
>
Cheers,
> In the web app I am testing, a
unique authorization code is generated at
> runtime and submitted with each http
request during that [web browser]
>
session. Jmeter script recorder stores the hardcoded
value, which again is
> only valid during
that session.
>
> I
can use the Regular Expression Extractor to capture the
authorization
> code ${AuthCode}, which
is generated on the 10th http request in the test
> plan. I need to tell JMETER to use this
new authorization code in all
>
subsequent http requests in the test. I can manually
replace all
> subsequent occurrences of
the code with the new value extracted
>
${AuthCode}, but this would mean hundreds of manual
changes.
>
> Is there
any way to tell JMETER that from a given point going
forward,
> ignore the hardcoded value of
the http request parameter and use the value
> extracted at the 10th call. This is
important because each test plan has
>
hundreds of calls and there will be multiple test plans for
the web site.
>
>
THX... BTW Joined today and this is my first post here. Hope
I'm doing
> this correctly.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Replace hardcoded request param with new value generated at runtime?
Posted by Deepak Shetty <sh...@gmail.com>.
Hi
the recorded script is a text file (the .jmx) and it is trivial to do a
find and replace (as opposed to but this would mean hundreds of manual
changes.)
However there probably is another way
http://jmeter.apache.org/usermanual/best-practices.html -- 16.5 Using the
HTTP(S) Test Script Recorder
* One of the most useful features of the HTTP(S) Test Script Recorder is
that you can abstract out certain common elements from the recorded
samples. By defining some user-defined variables
<http://jmeter.apache.org/usermanual/functions.html> at the Test Plan level
or in User Defined Variables
<http://jmeter.apache.org/usermanual/component_reference.html#User_Defined_Variables>
elements, you can have JMeter automatically replace values in you recorded
samples*
Because your value is not predetermined you either have to be able to use a
regex (not sure it works)
or pause your test - i.e. when you reach the step where the auth code is
generated , stop the recording proxy, note down the value , put it into the
value of the user defined variable then restart the recording proxy and
your test should replace all other occurrences with the defined variable
name.
regards
deepak
On Thu, Jul 24, 2014 at 8:32 AM, rxfillpharm <rx...@yahoo.com.invalid>
wrote:
> Cheers,
> In the web app I am testing, a unique authorization code is generated at
> runtime and submitted with each http request during that [web browser]
> session. Jmeter script recorder stores the hardcoded value, which again is
> only valid during that session.
>
> I can use the Regular Expression Extractor to capture the authorization
> code ${AuthCode}, which is generated on the 10th http request in the test
> plan. I need to tell JMETER to use this new authorization code in all
> subsequent http requests in the test. I can manually replace all
> subsequent occurrences of the code with the new value extracted
> ${AuthCode}, but this would mean hundreds of manual changes.
>
> Is there any way to tell JMETER that from a given point going forward,
> ignore the hardcoded value of the http request parameter and use the value
> extracted at the 10th call. This is important because each test plan has
> hundreds of calls and there will be multiple test plans for the web site.
>
> THX... BTW Joined today and this is my first post here. Hope I'm doing
> this correctly.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>