The regexFunction is applied to the previous result in the test run.
However, as with other Configuration items, the User Defined Variables test
element is processed before any samplers are run.
Thus the regexFunction will not have anything to work on.
So I think the solution is either to add a Regex Extractor element as a
child of the sampler that has returns the session id, or embed the
regexFunction directly in the next sampler that needs to use it.
==
By the way, regexes are "greedy", in particular "(.*)&" will not stop at the
first "&" - it will continue until it finds the last possible "&".
To make it non-greedy, use the "?" qualifier, e.g. "(.*?)&". Or code it as
"([^&]*)&", i.e. 0 or more characters that are "not &".
S.
----- Original Message -----
From: "Craig Palmer" <[EMAIL PROTECTED]>
To: "JMeter Users List" <[EMAIL PROTECTED]>
Sent: Friday, June 18, 2004 11:03 PM
Subject: RE: Unable to get __regexFunction to work
I havent used this function before so if you cant get the following to work
then I'll try it out and investigate it.
>From the user manua it says:
Stored values are ${refName} (the replacement template string) and
${refName_g#} where "#" is the group number from the regular expression ("0"
can be used to refer to the entire match).
Therefore see what is in the variable ${getSessionId_g1}
-----Original Message-----
From: ope [mailto:[EMAIL PROTECTED]
Sent: Sat 6/19/2004 6:47 AM
To: JMeter Users List
Cc:
Subject: RE: Unable to get __regexFunction to work
The sessionid may not necessarily be all numbers. It
is a random string that contains letters and numbers.
In any case I checked to be certain and neither
${getSessionId} or ${sessionid} appear in the recorded
session and I see the full SessionID.
Is the __regexFunction meant to be used in the way
that I describe? Can I put the function in the Value
column in User Defined Variables in the Test Plan?
The regular expression is ok I think because I can use
the same expression in a Regular Expression Extractor
and it works.
ope
--- "BAZLEY, Sebastian"
<[EMAIL PROTECTED]> wrote:
> That should be (\d+).
>
> -----Original Message-----
> From: Craig Palmer [mailto:[EMAIL PROTECTED]
> Sent: 18 June 2004 02:07
> To: JMeter Users List
> Subject: RE: Unable to get __regexFunction to work
>
>
> Wouldn't that be the ${getSessionId} variable? Also,
> if session ids are
> numeric, then consider
>
${__regexFunction(SessionID=(/d+),$1$,1,,NOSESSIONID,getSessionId)}
>
> -----Original Message-----
> From: ope [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 18, 2004 12:40 PM
> To: [EMAIL PROTECTED]
> Subject: Unable to get __regexFunction to work
>
> I am trying to use the __regexFunction but can't get
> it work the way that I want. Either I am
> misunderstanding the way that it works (most likely)
> or the function doesn't work.
>
> What I am trying to do is create a regex function
> that
> will match a SessionID found in returned web pages
> while recording a session. What I have done is
> created a User Defined Variable in the Test Plan.
> The
> Name of the variable is sessionid and I have put the
> following __regexFunction in for the Value:
>
${__regexFunction(SessionID=(.*)&,$1$,1,,NOSESSIONID,getSessionId)}
>
> The SessionID will be found in a string that looks
> something like this:
> screen=startScreen&SessionID=123456789&objectID=4321
>
> The I start the HTTP Proxy Server in the WorkBench
> and
> record my test. After running the test and stopping
> the proxy server I take a look in my recorded
> session
> and the sessionids have not been replaced with a
> ${sessionid} variable. I have some other user
> defined
> variables in the Test Plan that have hard coded
> values
> and they have all been replaced with the variable as
> expected.
>
> How can I use the __regexFunction to parse my
> recorded
> session and replace all instances of the actual
> session id with a variable? Is this possible in the
> way that I am trying to do it?
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
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]