You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Sandeep Rao <sr...@zensutra.com> on 2003/06/17 05:51:38 UTC

regexFunction

Hi all,

I have been browsing this list for sometime and found good help in
getting started with jmeter. This is my first post and this is regarding
the regexFunction. I will appreciate if you can help me get the solution
to my problem.

Response to my first http request is in xml format and I want to parse
it and get hold of one parameter - SessionID - and use it for my second
http request. Here is the response format of first http request:

<?xml version="1.0"?>
<Authenticate>
	<SessionID>D49DD65185E94BDFBBFD2E4D872F334965</SessionID>
	...

I want to get hold of the string 'D49DD65185E94BDFBBFD2E4D872F334965'
from the above response. Following is the structure of my test plan
setup:

- First http request
-- Response assertion
- Assertion results
- Second http request

In the Response assertion I have put in the following:

${__regexFunction(<SessionID>.*</SessionID>,$1$,1,,ss,SessionIDF)}

and in the Second http request I have added a parameter as follows:
SessionID  = ${SessionIDF}

Problem I have is that with the above format for the regex the assertion
fails with the following message:

first http request details
	Test failed, expected to contain: null

And of course, my second http request goes with the following parameter:
SessionID=null

If I change the parameter value in second request to 
SessionID  = ${SessionIDF_g1}
it still doesn't work. It sends the request with value as
SessionID=${SessionIDF_g1}

I did some tweaking and found some unexpected results. I changed the
regex function to as follows:

${__regexFunction(<SessionID>.*</SessionID>,$0$,1,,ss,SessionIDF)}

Note that the template value has changed from $1$ to $0$. When I test it
again the assertion for first request passes without any failures. But
my second request is sent with following parameters:
SessionID=<SessionID>D49DD65185E94BDFBBFD2E4D872F334965</SessionID>

This is not what I want. I only want the actual sessionid =
D49DD65185E94BDFBBFD2E4D872F334965

I know this is supposed to work and perhaps I am doing something wrong.
Can someone please help me resolve this?

Thanks a ton,
Sandeep 


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