JBehave
  1. JBehave
  2. JBEHAVE-278

'And' Step (AndStep) ignores CandidateStep step type

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.2, 3.0
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      On http://jbehave.org/reference/latest/concepts.html it states:

      "A step starting with And assumes the same meaning of the previous step"

      but this clearly isn't the case in practise, nor does it even require any preceeding step type to be defined. For example with:

      public class Steps extends org.jbehave.scenario.steps.Steps {
      @When("the wind blows")
      public void theWindBlows()

      { System.err.println("when it blows then boom"); }

      @Given("the wind blows")
      public void theWindBlows2()

      { System.err.println("given it blows then boom"); }

      }

      Scenario: Test
      And the wind blows
      Given the wind blows
      And the wind blows
      When the wind blows
      And the wind blows

      Outputs:

      when it blows then boom
      given it blows then boom
      when it blows then boom
      when it blows then boom
      when it blows then boom

      Obviously you wouldn't intend to start your scenario with an AndStep, but it's easy enough to get there (or produce one of the other problems) if you are copying/editing scenarios. I think it would be better if AndSteps assume the meaning of the previous step, as intended according to the web documentation.

        Activity

        Hide
        Mauro Talevi added a comment -

        The candidate step matching has been enhanced to support the previous step type when matching AND steps.

        If an AND step has no previous step (i.e. it starts a scenario) it will be marked as pending.

        Created and_step.scenario in trader example to verify behaviour.

        Show
        Mauro Talevi added a comment - The candidate step matching has been enhanced to support the previous step type when matching AND steps. If an AND step has no previous step (i.e. it starts a scenario) it will be marked as pending. Created and_step.scenario in trader example to verify behaviour.
        Mauro Talevi made changes -
        Field Original Value New Value
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 2.5.2 [ 16238 ]
        Component/s Core [ 11086 ]
        Component/s Story runner [ 11084 ]
        Mauro Talevi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Fix Version/s 3.0 [ 16302 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Tim Moore
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: