jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BAZLEY, Sebastian" <>
Subject RE: Using Response Assertion to evaluate HTML details
Date Wed, 01 Oct 2003 09:41:40 GMT
JMeter uses Jakarta ORO ( to
implement Perl5 patterns.

Since Perl includes multi-line patterns using the "m" and "s" modifiers:

<quote from Perlre document>

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. 


Treat string as single line. That is, change ``.'' to match any character
whatsoever, even a newline, which normally it would not match. 

It looks as though "s" might be best in your case.

As a start, you could try matching sample 8 times using something like:
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!

-----Original Message-----
From: []
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.


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
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-
> For additional commands, e-mail: jmeter-user-

Michael Stover
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message