You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Kyle McAbee <k....@treev.com> on 2004/10/12 23:16:01 UTC

Can number of regular expression matches be tested ?

Dear JMeter Users:

Is there a way to test the number of matches extracted by a Regular Expression Extractor element? 

The following code works. Unfortunately, it ALWAYS works. I used a regular expression tester to make sure that the target string occurs 4 times in the HTTP response text. If I understand the manual, when the condition in the If Controller evaluates to false, the test plan should stop. So specifying the wrong number of matches in the condition should stop the test plan. But it does not.

HTTP Request
  Regular Expression Extractor element
    Reference Name: Matches
    Regular Expression: string
    Template: $1$
    Match No: 1
    Default Value: NoMatches

  If Controller element
    Condition: Matches_matchNr == 4

Sincerely yours,

Kyle


Re: Can number of regular expression matches be tested ?

Posted by sebb <se...@gmail.com>.
On Tue, 12 Oct 2004 17:16:01 -0400, Kyle McAbee <k....@treev.com> wrote:
> Dear JMeter Users:
> 
> Is there a way to test the number of matches extracted by a Regular Expression Extractor element?

Yes, the xxx_matchNr  variable

> The following code works. Unfortunately, it ALWAYS works. I used a regular expression tester to make sure that the target string occurs 4 times in the HTTP response text. If I understand the manual, when the condition in the If Controller evaluates to false, the test plan should stop. So specifying the wrong number of matches in the condition should stop the test plan. But it does not.

The If controller only controls whether or not its children are
invoked. It does not stop a test, nor does it set the status of the
sampler to failed.
 
If you can work out the appropriate regex, you could use the Regex
Assertion to mark the sample as failed, and cause the test to stop
that way.

> HTTP Request
>   Regular Expression Extractor element
>     Reference Name: Matches
>     Regular Expression: string
>     Template: $1$
>     Match No: 1
>     Default Value: NoMatches
> 
>   If Controller element
>     Condition: Matches_matchNr == 4

This means to invoke any child samples of the If controller
 
> Sincerely yours,
> 
> Kyle
> 
>

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