JBehave
  1. JBehave
  2. JBEHAVE-312

Configuration option for non-greedy matchers for steps

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The biggest sore point for my team are the greedy reg-ex matchers for step prose.

      This was somewhat solved in another ticket which added a priority field to the annotation.

      However, this does not scale well with a large amount of steps. It's unmanageable, and a bit ugly, to have to worry about a global priority number.

      This problem would be best fixed if the reg-ex matcher was simply non-greedy. A usable solution, I think, would be to provide a configuration option in the StepsConfiguration to enable this.

      (On a side note, you may want to consider moving to a feature rich templating language like velocity).

        Activity

        Hide
        Szczepan Faber added a comment -

        +1

        I don't use jBehave in anger (however, I do use other tool that is very similar and I would like to move to jbehave). I cannot imagine a use case when I want the regexp groups to be greedy. Again, I'm a newbie so don't listen to me too much...

        Show
        Szczepan Faber added a comment - +1 I don't use jBehave in anger (however, I do use other tool that is very similar and I would like to move to jbehave). I cannot imagine a use case when I want the regexp groups to be greedy. Again, I'm a newbie so don't listen to me too much...
        Hide
        James Ravn added a comment -

        I would consider any dependency on the greedy matching to be broken. It makes no sense at all, because it essentially hides other steps - when would anyone ever depend on this? Keeping it for backwards compatibility is non-sensical and just causes pain.

        For example, if I created this step:

        @Given("$anything") public void anything(String anAnything) {}
        

        It will hide every single other step in my tests. How is this useful? Remove the greedy qualifier or give us a config option. Please . This single issue makes me dislike jbehave more and more every time I have to waste effort on it.

        Show
        James Ravn added a comment - I would consider any dependency on the greedy matching to be broken. It makes no sense at all, because it essentially hides other steps - when would anyone ever depend on this? Keeping it for backwards compatibility is non-sensical and just causes pain. For example, if I created this step: @Given( "$anything" ) public void anything( String anAnything) {} It will hide every single other step in my tests. How is this useful? Remove the greedy qualifier or give us a config option. Please . This single issue makes me dislike jbehave more and more every time I have to waste effort on it.
        Hide
        Mauro Talevi added a comment -

        The prioritisation strategy is now configurable in 3.x: http://jbehave.org/reference/latest/prioritising-steps.html

        Show
        Mauro Talevi added a comment - The prioritisation strategy is now configurable in 3.x: http://jbehave.org/reference/latest/prioritising-steps.html

          People

          • Assignee:
            Unassigned
            Reporter:
            James Ravn
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: