You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Petteri Heinonen <pe...@bothi.fi> on 2007/10/05 13:05:19 UTC
negated regexps in assertion rules
Hi,
I would like to check for the following rules in my Response Assertion:
- Response must include string "SERVER_ItemTypes_MDID" string.
- Response must not include any other "Server_*_MDID" strings.
I have two Response Assertion elements. First one simply checks that
SERVER_ItemTypes_MDID exists in the response.
But how to define the second one? I have a Response Assertion element
with "Not" selected in Pattern Matching Rules, and then I've added this
pattern: SERVER_(?!ItemTypes)_MDID . Now, if there exists for example
string "SERVER_Foobar_MDID" in the response, it should match that
pattern, and the assertion should fail. But, for some reason, it doesn't
match and thus assertion falsely reports success.
Any ideas what might be wrong in my regexp?
Regards, Petteri Heinonen
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: negated regexps in assertion rules
Posted by sebb <se...@gmail.com>.
There's a useful ORO tester at:
http://jakarta.apache.org/oro/demo.html
This shows that
SERVER_(?!ItemTypes)_MDID
does not match
SERVER_Foobar_MDID
Why is that?
Remember that (?!xxx) is a zero-width assertion, so it does not
consume any characters. It does match
SERVER__MDID
(two _ in a row)
So you can try dropping the _MDID from the pattern. If this creates
false positives, then you will need to add something like
\w+ or [^_]+
to consume the characters.
On 05/10/2007, Petteri Heinonen <pe...@bothi.fi> wrote:
> Hi,
>
> I would like to check for the following rules in my Response Assertion:
>
> - Response must include string "SERVER_ItemTypes_MDID" string.
> - Response must not include any other "Server_*_MDID" strings.
>
> I have two Response Assertion elements. First one simply checks that
> SERVER_ItemTypes_MDID exists in the response.
>
> But how to define the second one? I have a Response Assertion element
> with "Not" selected in Pattern Matching Rules, and then I've added this
> pattern: SERVER_(?!ItemTypes)_MDID . Now, if there exists for example
> string "SERVER_Foobar_MDID" in the response, it should match that
> pattern, and the assertion should fail. But, for some reason, it doesn't
> match and thus assertion falsely reports success.
>
> Any ideas what might be wrong in my regexp?
>
> Regards, Petteri Heinonen
>
>
>
> ---------------------------------------------------------------------
> 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