jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Yuen <dyuen...@yahoo.com>
Subject RE: Using Response Assertion to evaluate HTML details
Date Wed, 01 Oct 2003 16:42:50 GMT
Thanks, everyone, for your responses.  I really
appreciate your assistance.

I'm looking into the m and the s modifiers and I'm
having some difficulties using them in Response
Assertions.  For example, if my response is an HTML
page with exactly 8 occurrence of the word "sample", I
am able to use a Response Assertion to match the
pattern 

sam.*e

But it fails if I change the pattern to 

m/sam.*e/

According to the Perl textbook I'm using, the m
modifier is optional when the slashes are used.  So,
shouldn't the pattern m/sam.*e/ produce the same
results as sam*.e    ?

Am I using the m modifier incorrectly?  Is the reason
that m/sam.*e/ doesn't work in the Response Assertion
because the regular expression is sam.*e and the m
modifiers and the slashes are modifiers/delimiters and
not really part of the regular expression (so don't
belong in the Response Assertion)?

Please let me know if I've got a basic
misunderstanding someplace.  But, as I see it so far,
the patterns in the Response Assertion will only match
on a one-line-at-a-time basis and are not used to
match the response as a whole.  

Thanks very much.

Dan Yuen


--- "BAZLEY, Sebastian"
<Sebastian.BAZLEY@london.sema.slb.com> wrote:
> True, but won't it stop looking when it has found 8
> matches?
> i.e. there could be more "sample"s later in the
> buffer?
> 
> ==
> 
> One could try anchoring the last sample:
> 
> (sample.*){7,7}(sample.*$){1,1}
> 
> but I think that would suffer from the same problem
> as the negative
> look-ahead.
> It may be tricky stopping the matcher from working
> its way past the leading
> samples.
> 
> S.
> -----Original Message-----
> From: mstover1@apache.org
> [mailto:mstover1@apache.org]
> Sent: 01 October 2003 13:31
> To: JMeter Users List
> Subject: RE: Using Response Assertion to evaluate
> HTML details
> 
> 
> Also,
> 
> (sample.*){8,8} will match exactly 8 occurrences. 
> 
> -Mike
> 
> On 1 Oct 2003 at 10:41, BAZLEY, Sebastian wrote:
> 
> > JMeter uses Jakarta ORO
> (http://jakarta.apache.org/oro/index.html) to
> > implement Perl5 patterns.
> > 
> > Since Perl includes multi-line patterns using the
> "m" and "s" 
> modifiers:
> > 
> > <quote from Perlre document>
> > m
> > 
> > Treat string as multiple lines. That is, change
> ``^'' and ``$'' from
> > matching the start or end of the string to
> matching the start or end 
> of any
> > line anywhere within the string. 
> > 
> > s
> > 
> > Treat string as single line. That is, change ``.''
> to match any 
> character
> > whatsoever, even a newline, which normally it
> would not match. 
> > </quote>
> > 
> > It looks as though "s" might be best in your case.
> > 
> > As a start, you could try matching sample 8 times
> using 
> something like:
> > (sample.*){8}
> > This would eliminate fewer than 8 occurrences.
> > 
> > (sample.*){9} should catch ones with 9 or more.
> > 
> > So you could use two assertions; the first to
> match 8 samples, the 
> second to
> > NOT match 9.
> > 
> > The tricky bit would be combining the two, as 
> (sample.*){8}(?!.*sample)
> > would presumably be happy to match 9 occurrences
> by starting 
> the match with
> > the second sample.
> > 
> > I'm afraid I'll have to leave solving that as an
> exercise for the 
> reader, as
> > I don't know how myself.
> > 
> > I could not find anything on the ORO pages about
> exactly what 
> REs it
> > supports, or if there are any exclusions.
> > 
> > Perl itself has pretty good documentation on
> regular expressions. 
> If you
> > have a Perl installation, try perldoc perlre,
> perlrequick or 
> perlretut.
> > There is online documentation on the Activestate
> web-site and 
> elsewehere. 
> > 
> > Hope this will help you get started. If you find a
> good solution, 
> please
> > share it with us!
> > 
> > S.*n
> > -----Original Message-----
> > From: mstover1@apache.org
> [mailto:mstover1@apache.org]
> > Sent: 01 October 2003 00:10
> > To: JMeter Users List
> > Subject: Re: Using Response Assertion to evaluate
> HTML details
> > 
> > 
> > Currently, the Response Assertion only supports a
> yes/no 
> response 
> > to whether the text includes the regex. 
> Supporting match counts 
> > would be useful too, I think.
> > 
> > -Mike
> > 
> > On 30 Sep 2003 at 15:39, Dan Yuen wrote:
> > 
> > > I've started looking at JMeter for testing some
> html
> > > pages on a web app.  I was wondering how much
> > > flexibility i might have with the regular
> expressions
> > > in the Response Assertion.
> > > 
> > > I've seen how an Assertion Results can report
> back
> > > whether or not it finds an occurrence of a
> certain
> > > pattern in a line.  But can I use this feature
> to, for
> > > example, verify that my response is an html page
> with
> > > exactly eight occurrences of the word "sample"
> within
> > > a
> > > <pre></pre> tag somewhere in the body of the
> page?
> > > 
> > > Am I limited to testing for only patterns
> contained in
> > > a single line?
> > > 
> > > Thanks very much.
> > > 
> > > Dan Yuen
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Mime
View raw message