Hi David,

yes, ATM it only matches the step against the pattern specified in the
annotation.   It can return multiple stepdocs (i.e. methods) matching
the given step.

The improvement you suggest is not trivial because we'd need to do a
matching of a pattern against another pattern, instead of a string
against a pattern.

Regardless of the technical details which we can sort out, how would you
see it working in terms of regex?

The method pattern looks something like :

@Given("a date of $date")

The pattern gets converted into a regex by the StepPatternParser:

"a\s+date\s+of\s+(.*)"

and used to match steps such as:

"Given a date of 01/01/2011".

How would you match a regex pattern against another regex pattern?

Cheers



On 11/07/2011 02:57, Alves, David wrote:
>
> Mauro,
>
>  
>
> I have already implemented both of these solutions, however, they
> require me (at least as far as I can tell) to put in the Given, When,
> or Then step pattern exactly to find it.
>
>  
>
> The API, as is, does not appear to allow me to say find all “When’s”
> that begin like this, “When I click on….”, or, as originally stated
> return ALL, and only all “Givens”, using a pattern match/regex on the
> step pattern itself (i.e. – Given*, or Given.*).
>
>  
>
> Do you know if this can be done with the API without coding the
> matching myself?
>
>  
>
> Thanks.
>
> David
>
>  
>
> *From:*Mauro Talevi [mailto:[email protected]]
> *Sent:* Friday, July 08, 2011 5:14 PM
> *To:* [email protected]
> *Subject:* Re: [jbehave-user] Pattern matching on Steps
>
>  
>
> Hi David,
>
> it is indeed possible. 
>
> In core:  http://jbehave.org/reference/stable/finding-steps.html
>
> In web:  http://jbehave.org/reference/web/stable/using-web-runner.html
>
> Cheers
>
> On 08/07/2011 19:16, Alves, David wrote:
>
> Does anyone know if it is possible to query your inventory of step
> candidates (i.e. – via StepFinder, etc.), using partial matches,
> wildcards, or regex, via the framework itself (either core or using
> webrunner)?
>
>  
>
> i.e. – “Given”, or “Given*”, or “Given(.*)” would return ALL “Given”
> patterns constructed thus far, that exist?
>
>  
>
> Obviously I could code something myself, but I am not quite certain
> that the framework cannot do this itself and was wondering if anyone
> else has actually done this or used it if it is already built-in?
>
>  
>
> Thanks.
>
> David
>
>
>
> The information contained in this email message and its attachments is
> intended only for the private and confidential use of the recipient(s)
> named above, unless the sender expressly agrees otherwise.
> Transmission of email over the Internet is not a secure communications
> medium. If you are requesting or have requested the transmittal of
> personal data, as defined in applicable privacy laws by means of email
> or in an attachment to email, you must select a more secure alternate
> means of transmittal that supports your obligations to protect such
> personal data. If the reader of this message is not the intended
> recipient and/or you have received this email in error, you must take
> no action based on the information in this email and you are hereby
> notified that any dissemination, misuse or copying or disclosure of
> this communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by email and
> delete the original message.
>
>  
>

Reply via email to