JBehave
  1. JBehave
  2. JBEHAVE-279

GivenScenarios runs called scenario as PENDING not the implemented version

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Not A Bug
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.2
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Eclipse, JDK1.5, MacOS
    • Number of attachments :
      1

      Description

      We are trying to use GivenScenarios but when the scenario containing it runs it generate the PENDING steps not the actual steps. When the called scenario is run independently it runs fine. My step implementation are simply printlns. This is just running in Eclipse with jbehave-core-2.5.1. Any idea what we could be missing here. As a workaround I can embed the steps method for the first scenario before the steps method of the second then it works as expected.
      Please see attached source in bdd1.jar
      tx
      Warren

      1. user_logs_in_successfully
      Given I am not logged in
      When I log in as Liz with a password abc
      Then I should see a message, "Welcome, Liz!"

      output:
      runBeforeScenario
      logged out
      login for user: csm with password: abc
      checkMessage: Welcome, Liz!
      runThisAfterScenarioAny
      runThisAfterScenarioSuccess

      2. user_places_an_order
      Scenario: User logs in and places an order
      GivenScenarios: com/test/examples/scenarios/user_logs_in_successfully.scenario
      When I place an order
      Then I should see a message, "Order placed"

      output:
      (com/test/examples/scenarios/user_logs_in_successfully.scenario)
      Scenario:
      Given I am not logged in (PENDING)
      When I log in as service with a password service (PENDING)
      Then I should see a message, "Welcome, CSM!" (NOT PERFORMED)

      placing Order
      checkMessage: Order placed

      3. Run user_places_an_order with workaround (embedded steps method). Interesting is that the before and after steps of the first steps class is run in the second as well.

      output:
      runBeforeScenario
      logged out
      login for user: Liz with password: abc
      checkMessage: Welcome, Liz!
      runThisAfterScenarioAny
      runThisAfterScenarioSuccess
      runBeforeScenario
      placing Order
      checkMessage: Order placed
      runThisAfterScenarioAny
      runThisAfterScenarioSuccess

        Activity

        Hide
        Mauro Talevi added a comment -

        Warren,

        you need to add all the Steps instances that your Scenario will need to match the steps.

        So, e.g., in UserPlacesAnOrder (which requires both login and order steps) you need

        addSteps(new LoginSteps(), new PlaceOrderSteps());

        and not just

        addSteps(new PlaceOrderSteps());

        else the scenario won't know how to match the login steps, as you are experiencing.

        Show
        Mauro Talevi added a comment - Warren, you need to add all the Steps instances that your Scenario will need to match the steps. So, e.g., in UserPlacesAnOrder (which requires both login and order steps) you need addSteps(new LoginSteps(), new PlaceOrderSteps()); and not just addSteps(new PlaceOrderSteps()); else the scenario won't know how to match the login steps, as you are experiencing.
        Hide
        Mauro Talevi added a comment -

        Not a bug, just a misconfiguration, as per comment.

        Show
        Mauro Talevi added a comment - Not a bug, just a misconfiguration, as per comment.
        Mauro Talevi made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 2.5.2 [ 16238 ]
        Resolution Not A Bug [ 6 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Warren Muller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: