You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Neal O'Connell <ne...@mi-assistant.com> on 2004/03/23 22:20:18 UTC

Newb needs regular expression help

I'm having a little trouble with regular expressions.  Here is the basic
flow of the web application when used in a browser

- User requests page
- Server returns a frameset (the requested page is in the frameset).  A link
on the frameset page includes a query parameter that has a unique identifier
for session tracking (SessionID is the variable name)

General layout of my script is (using v1.9.1)

- Thread Group
  - First Page (GET) (returns a frameset)
    - Regular Expression Extractor to get SessionID
  - Second page (POST) (passes SessionID as a variable)

My regular expression has the following properties

Ref Name: SessionID
Reg Expr: (SessionID=)(.*)([&"])
Template: $2$
Match No: 1
Default: 0

I'm obviously missing something, because when I monitor the server I can see
that the SessionID that gets POSTed with the second page has a default value
of 0 rather than what should have been parsed out of the extractor.

>From my (albeit minimal) understanding of regular expressions, I expect that
this will look for text in the response that fits the pattern:

Starts with "SessionID="
Ends with " or &
Can have 0 or more characters in between.

And the parantheses break the expression into three groups:
1 - "SessionID" string literal
2 - SessionID value
3 - " or & character

So setting the Template to $2$ means put the second group into the variable.

A snippet from the frameset might help:

  <frame name="visibleFrame"
src="mainpage.htm?InstanceID=1193356129&SessionID=wiQHYYlHzYEokrCo">


Can somebody please help me out?  Maybe I just need to find a quality
regular expressions tutorial...


Thanks!

Neal O'Connell | Developer
Phone: 859.245.3841 | Fax: 715.287.4499
MI-Assistant - A Division of Fiserv, FSC 
26550 W. Mondovi Street | Eleva, WI  54738
http://www.mi-assistant.com


Re: Newb needs regular expression help

Posted by Mark Lybarger <ma...@wideopenwest.com>.
Neal,

Here's the attachment. Hope it gets through ok. It should show that 
indeed your regex works ok and give an example of how to test out your 
regexes.

Does your http request that's getting the frameset follow redirects? It 
sounds like it if you're seeing the data as a child of the actual 
requets. The only redirects i've worked with thus far were on our login 
page, and I didn't bother to add an assertion to the response. A quick 
skim of the bugzilla doesn't show anything up on this though.

 From my experience, Jmeter is time consuming to setup and get working 
properly for complex applications, but its ability to be scripted (ant) 
and easily modified after you learn the product is well worth it.

~mark

Neal O'Connell wrote:

>Thanks for the response.  I'll take you up on that jmx offer.  That is bound
>to shed some light on my problem.
>
>Some more data.  I added to the Thread Group
>
>- View Results Tree
>- Assertion Results
>
>And to the First Page
>- Response Assertion, looking for the pattern: Session=
>
>When I run the test, the assertion fails.
>Also the View Results Tree shows the requested page name in red, but the
>Response Data shows the frameset page complete with SessionID.
>
>A little clarification on the application I am testing might help.  The site
>is set up so that you request a page and the server redirects you a
>frameset.  One of the frames contains the page you requested.
>
>I fiddled with the test so that the frameset is called directly and I got
>pretty much the same results.  The assertion fails, and the View Results
>Tree shows the page name in red.  There is one major difference:
>
>When requesting the frameset directly I see the Response Data when I click
>on the node.  When using redirection, there is actually a child node under
>the red one that contains the Response Data.  With redirection, the parent
>node only contains http headers (content-length, content-type, etc) and the
>HTTP Response Code is 302.
>
>
>I'm beginning to suspect that I'm going to have some problems getting JMeter
>to work with my application.
>
>Thanks,
>Neal
>
>-----Original Message-----
>From: Mark Lybarger [mailto:marklybarger@wideopenwest.com] 
>Sent: Tuesday, March 23, 2004 5:21 PM
>To: JMeter Users List
>Subject: Re: Newb needs regular expression help
>
>
>Neal,
>
>The regexes definately take some fiddling to get confidence that they 
>work. I've found it works nicely to use a couple Java Requests, along 
>with  a Regular Expression Extractor and a Response Assertion, a user 
>parameter and some playing around with the expressions to see what the 
>output is.
>
>In your case, the regex you posted seems to be correct.  At least it's 
>working for me.  I can send you the jmx that i've mocked up if you 
>like.  Maybe it has something to do with the frame/frameset that you're 
>using?
>
>~mark
>
>Neal O'Connell wrote:
>
>  
>
>>I'm having a little trouble with regular expressions.  Here is the 
>>basic flow of the web application when used in a browser
>>
>>- User requests page
>>- Server returns a frameset (the requested page is in the frameset).  A 
>>link on the frameset page includes a query parameter that has a unique 
>>identifier for session tracking (SessionID is the variable name)
>>
>>General layout of my script is (using v1.9.1)
>>
>>- Thread Group
>> - First Page (GET) (returns a frameset)
>>   - Regular Expression Extractor to get SessionID
>> - Second page (POST) (passes SessionID as a variable)
>>
>>My regular expression has the following properties
>>
>>Ref Name: SessionID
>>Reg Expr: (SessionID=)(.*)([&"])
>>Template: $2$
>>Match No: 1
>>Default: 0
>>
>>I'm obviously missing something, because when I monitor the server I 
>>can see that the SessionID that gets POSTed with the second page has a 
>>default value of 0 rather than what should have been parsed out of the 
>>extractor.
>>
>>>>From my (albeit minimal) understanding of regular expressions, I 
>>    
>>
>>>expect that
>>>      
>>>
>>this will look for text in the response that fits the pattern:
>>
>>Starts with "SessionID="
>>Ends with " or &
>>Can have 0 or more characters in between.
>>
>>And the parantheses break the expression into three groups:
>>1 - "SessionID" string literal
>>2 - SessionID value
>>3 - " or & character
>>
>>So setting the Template to $2$ means put the second group into the 
>>variable.
>>
>>A snippet from the frameset might help:
>>
>> <frame name="visibleFrame" 
>>src="mainpage.htm?InstanceID=1193356129&SessionID=wiQHYYlHzYEokrCo">
>>
>>
>>Can somebody please help me out?  Maybe I just need to find a quality 
>>regular expressions tutorial...
>>
>>
>>Thanks!
>>
>>Neal O'Connell | Developer
>>Phone: 859.245.3841 | Fax: 715.287.4499
>>MI-Assistant - A Division of Fiserv, FSC
>>26550 W. Mondovi Street | Eleva, WI  54738
>>http://www.mi-assistant.com
>>
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>  
>


RE: Newb needs regular expression help

Posted by Neal O'Connell <ne...@mi-assistant.com>.
Mark & Lee,

Thanks for your help!

Between the two of you I was able to figure out what was going on.  

Using the suggested reg expr of SessionID=([^&"]+)[&"] I was able to get the
SessionID when I directly request the frameset.  But when I request the page
that redirects to the frameset, SessionID is set to the default.  (I do have
the HTTP Request set to follow redirects.)

Does this sound like a bug to anyone else?  It seems to me that if the
request is set to follow redirects, shouldn't the items that depend on it
(reg expr, assertions) wait until the redirect has completed and use the
redirected response?

Maybe I'm just missing some JMeter setting?

Thanks!
Neal


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


RE: Newb needs regular expression help

Posted by Neal O'Connell <ne...@mi-assistant.com>.
Thanks for the response.  I'll take you up on that jmx offer.  That is bound
to shed some light on my problem.

Some more data.  I added to the Thread Group

- View Results Tree
- Assertion Results

And to the First Page
- Response Assertion, looking for the pattern: Session=

When I run the test, the assertion fails.
Also the View Results Tree shows the requested page name in red, but the
Response Data shows the frameset page complete with SessionID.

A little clarification on the application I am testing might help.  The site
is set up so that you request a page and the server redirects you a
frameset.  One of the frames contains the page you requested.

I fiddled with the test so that the frameset is called directly and I got
pretty much the same results.  The assertion fails, and the View Results
Tree shows the page name in red.  There is one major difference:

When requesting the frameset directly I see the Response Data when I click
on the node.  When using redirection, there is actually a child node under
the red one that contains the Response Data.  With redirection, the parent
node only contains http headers (content-length, content-type, etc) and the
HTTP Response Code is 302.


I'm beginning to suspect that I'm going to have some problems getting JMeter
to work with my application.

Thanks,
Neal

-----Original Message-----
From: Mark Lybarger [mailto:marklybarger@wideopenwest.com] 
Sent: Tuesday, March 23, 2004 5:21 PM
To: JMeter Users List
Subject: Re: Newb needs regular expression help


Neal,

The regexes definately take some fiddling to get confidence that they 
work. I've found it works nicely to use a couple Java Requests, along 
with  a Regular Expression Extractor and a Response Assertion, a user 
parameter and some playing around with the expressions to see what the 
output is.

In your case, the regex you posted seems to be correct.  At least it's 
working for me.  I can send you the jmx that i've mocked up if you 
like.  Maybe it has something to do with the frame/frameset that you're 
using?

~mark

Neal O'Connell wrote:

>I'm having a little trouble with regular expressions.  Here is the 
>basic flow of the web application when used in a browser
>
>- User requests page
>- Server returns a frameset (the requested page is in the frameset).  A 
>link on the frameset page includes a query parameter that has a unique 
>identifier for session tracking (SessionID is the variable name)
>
>General layout of my script is (using v1.9.1)
>
>- Thread Group
>  - First Page (GET) (returns a frameset)
>    - Regular Expression Extractor to get SessionID
>  - Second page (POST) (passes SessionID as a variable)
>
>My regular expression has the following properties
>
>Ref Name: SessionID
>Reg Expr: (SessionID=)(.*)([&"])
>Template: $2$
>Match No: 1
>Default: 0
>
>I'm obviously missing something, because when I monitor the server I 
>can see that the SessionID that gets POSTed with the second page has a 
>default value of 0 rather than what should have been parsed out of the 
>extractor.
>
>>>From my (albeit minimal) understanding of regular expressions, I 
>>expect that
>this will look for text in the response that fits the pattern:
>
>Starts with "SessionID="
>Ends with " or &
>Can have 0 or more characters in between.
>
>And the parantheses break the expression into three groups:
>1 - "SessionID" string literal
>2 - SessionID value
>3 - " or & character
>
>So setting the Template to $2$ means put the second group into the 
>variable.
>
>A snippet from the frameset might help:
>
>  <frame name="visibleFrame" 
>src="mainpage.htm?InstanceID=1193356129&SessionID=wiQHYYlHzYEokrCo">
>
>
>Can somebody please help me out?  Maybe I just need to find a quality 
>regular expressions tutorial...
>
>
>Thanks!
>
>Neal O'Connell | Developer
>Phone: 859.245.3841 | Fax: 715.287.4499
>MI-Assistant - A Division of Fiserv, FSC
>26550 W. Mondovi Street | Eleva, WI  54738
>http://www.mi-assistant.com
>
>
>  
>



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



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


Re: User-defined parameter

Posted by Ryo Sode <ry...@filemaker.com>.
Excellent!! FAQ entry #7 covered my issue. ... I should have read the FAQ
earlier. They tell me to RTFM but they don't tell me to RTFAQ often enough.
;P

Ryo


> Passing in parameters via the command line is covered in the FAQ.
> ----- Original Message -----
> From: "Ryo Sode" <ry...@filemaker.com>
> To: "JMeter Users List" <jm...@jakarta.apache.org>
> Sent: Thursday, July 01, 2004 8:50 PM
> Subject: User-defined parameter
> 
> 
>> Hi all,
>> 
>> Is there a way to pass in user-defined parameters when running a Jmeter in
>> non-GUI mode? I guess StringFromFile function is the closest solution I
>> found on the documentation, but then it's not convenient enough because
> you
>> can't specify the parameters in the form of
> "parameter_name=parameter_value"
>> and one has to be careful about the ordering of those values in the file.
>> 
>> Ryo
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 

--------
Ryo Sode
SQA Lead Engineer
Internet Division
FileMaker Inc.
TEL 408.987.7500
AIM ScreenName: ryosode



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


Re: User-defined parameter

Posted by Sebastian Bazley <se...@apache.org>.
Passing in parameters via the command line is covered in the FAQ.
----- Original Message ----- 
From: "Ryo Sode" <ry...@filemaker.com>
To: "JMeter Users List" <jm...@jakarta.apache.org>
Sent: Thursday, July 01, 2004 8:50 PM
Subject: User-defined parameter


> Hi all,
>
> Is there a way to pass in user-defined parameters when running a Jmeter in
> non-GUI mode? I guess StringFromFile function is the closest solution I
> found on the documentation, but then it's not convenient enough because
you
> can't specify the parameters in the form of
"parameter_name=parameter_value"
> and one has to be careful about the ordering of those values in the file.
>
> Ryo
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>


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


User-defined parameter

Posted by Ryo Sode <ry...@filemaker.com>.
Hi all,

Is there a way to pass in user-defined parameters when running a Jmeter in
non-GUI mode? I guess StringFromFile function is the closest solution I
found on the documentation, but then it's not convenient enough because you
can't specify the parameters in the form of "parameter_name=parameter_value"
and one has to be careful about the ordering of those values in the file.

Ryo



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


Re: Newb needs regular expression help

Posted by Mark Lybarger <ma...@wideopenwest.com>.
Neal,

The regexes definately take some fiddling to get confidence that they 
work. I've found it works nicely to use a couple Java Requests, along 
with  a Regular Expression Extractor and a Response Assertion, a user 
parameter and some playing around with the expressions to see what the 
output is.

In your case, the regex you posted seems to be correct.  At least it's 
working for me.  I can send you the jmx that i've mocked up if you 
like.  Maybe it has something to do with the frame/frameset that you're 
using?

~mark

Neal O'Connell wrote:

>I'm having a little trouble with regular expressions.  Here is the basic
>flow of the web application when used in a browser
>
>- User requests page
>- Server returns a frameset (the requested page is in the frameset).  A link
>on the frameset page includes a query parameter that has a unique identifier
>for session tracking (SessionID is the variable name)
>
>General layout of my script is (using v1.9.1)
>
>- Thread Group
>  - First Page (GET) (returns a frameset)
>    - Regular Expression Extractor to get SessionID
>  - Second page (POST) (passes SessionID as a variable)
>
>My regular expression has the following properties
>
>Ref Name: SessionID
>Reg Expr: (SessionID=)(.*)([&"])
>Template: $2$
>Match No: 1
>Default: 0
>
>I'm obviously missing something, because when I monitor the server I can see
>that the SessionID that gets POSTed with the second page has a default value
>of 0 rather than what should have been parsed out of the extractor.
>
>>>From my (albeit minimal) understanding of regular expressions, I expect that
>this will look for text in the response that fits the pattern:
>
>Starts with "SessionID="
>Ends with " or &
>Can have 0 or more characters in between.
>
>And the parantheses break the expression into three groups:
>1 - "SessionID" string literal
>2 - SessionID value
>3 - " or & character
>
>So setting the Template to $2$ means put the second group into the variable.
>
>A snippet from the frameset might help:
>
>  <frame name="visibleFrame"
>src="mainpage.htm?InstanceID=1193356129&SessionID=wiQHYYlHzYEokrCo">
>
>
>Can somebody please help me out?  Maybe I just need to find a quality
>regular expressions tutorial...
>
>
>Thanks!
>
>Neal O'Connell | Developer
>Phone: 859.245.3841 | Fax: 715.287.4499
>MI-Assistant - A Division of Fiserv, FSC 
>26550 W. Mondovi Street | Eleva, WI  54738
>http://www.mi-assistant.com
>
>
>  
>



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


Re: Newb needs regular expression help

Posted by BIJUMON RAMACHANDRAN <bi...@yahoo.com>.
> Ref Name: SessionID
> Reg Expr: if it is of standard length (mix char &
digits) just use following format (example: of length
8 means) (\w\w\w\w\w\w\w\w)
or 
if it is just digits (example: of length 8 means)
(\d\d\d\d\d\d\d\d)

> Template: $1$
> Match No: 0
> Default: 0

biju

--- Neal O'Connell <ne...@mi-assistant.com>
wrote:
> I'm having a little trouble with regular
> expressions.  Here is the basic
> flow of the web application when used in a browser
> 
> - User requests page
> - Server returns a frameset (the requested page is
> in the frameset).  A link
> on the frameset page includes a query parameter that
> has a unique identifier
> for session tracking (SessionID is the variable
> name)
> 
> General layout of my script is (using v1.9.1)
> 
> - Thread Group
>   - First Page (GET) (returns a frameset)
>     - Regular Expression Extractor to get SessionID
>   - Second page (POST) (passes SessionID as a
> variable)
> 
> My regular expression has the following properties
> 
> Ref Name: SessionID
> Reg Expr: (SessionID=)(.*)([&"])
> Template: $2$
> Match No: 1
> Default: 0
> 
> I'm obviously missing something, because when I
> monitor the server I can see
> that the SessionID that gets POSTed with the second
> page has a default value
> of 0 rather than what should have been parsed out of
> the extractor.
> 
> From my (albeit minimal) understanding of regular
> expressions, I expect that
> this will look for text in the response that fits
> the pattern:
> 
> Starts with "SessionID="
> Ends with " or &
> Can have 0 or more characters in between.
> 
> And the parantheses break the expression into three
> groups:
> 1 - "SessionID" string literal
> 2 - SessionID value
> 3 - " or & character
> 
> So setting the Template to $2$ means put the second
> group into the variable.
> 
> A snippet from the frameset might help:
> 
>   <frame name="visibleFrame"
>
src="mainpage.htm?InstanceID=1193356129&SessionID=wiQHYYlHzYEokrCo">
> 
> 
> Can somebody please help me out?  Maybe I just need
> to find a quality
> regular expressions tutorial...
> 
> 
> Thanks!
> 
> Neal O'Connell | Developer
> Phone: 859.245.3841 | Fax: 715.287.4499
> MI-Assistant - A Division of Fiserv, FSC 
> 26550 W. Mondovi Street | Eleva, WI  54738
> http://www.mi-assistant.com
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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