JBehave
  1. JBehave
  2. JBEHAVE-474

Pending step method generation fails with And steps

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.3.2, 3.4
    • Component/s: Core
    • Labels:
      None
    • Environment:
      JDK 1.6.0_24 on Mac OS Snow Leopard
    • Number of attachments :
      0

      Description

      When I run over a scenario with 'and' steps, pending method generation fails. The same scenario without the 'and' steps generates methods without any problem (and is jolly useful).

      The failure happens in 3.3.1 and in 3.4-SNAPSHOT, commit c27f34.

      The failure results from an NPE; JBehave knows the story has failed, but the run times out and then exits with 'pass' from the JUnit POV. Is that the expected behaviour, btw?

      Failing scenario:

      Scenario: When I log in with good credentials after having been redirected to the login page from my intended page, I am redirected to my intended page

      Given I am not logged in
      And I have been redirected from my intended page to the login page
      When I log in with good credentials
      Then I am redirected to my intended page
      And I am logged in

      Console output:

      Scenario: When I log in with good credentials after having been redirected to the login page from my intended page, I am redirected to my intended page
      Given I am not logged in (PENDING)
      And I have been redirected from my intended page to the login page (PENDING)
      When I log in with good credentials (PENDING)
      Then I am redirected to my intended page (PENDING)
      And I am logged in (PENDING)
      Failed to run story package.name.here/login/i_can_log_in_with_correct_credentials.story
      java.lang.NullPointerException
      at org.jbehave.core.steps.PendingStepMethodGenerator.stepStartsWithWord(PendingStepMethodGenerator.java:86)
      at org.jbehave.core.steps.PendingStepMethodGenerator.findStepType(PendingStepMethodGenerator.java:64)
      at org.jbehave.core.steps.PendingStepMethodGenerator.generateMethod(PendingStepMethodGenerator.java:32)
      at org.jbehave.core.embedder.StoryRunner.generatePendingStepMethods(StoryRunner.java:287)
      at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:272)
      at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:170)
      at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:95)
      at org.jbehave.core.embedder.Embedder$EnqueuedStory.call(Embedder.java:686)
      at org.jbehave.core.embedder.Embedder$EnqueuedStory.call(Embedder.java:1)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
      Story package.name.here/login/i_can_log_in_with_correct_credentials.story has timed out after 61 seconds
      Generating reports view to '/Users/jonathanwoods/Documents/workspaces/main/mobile/target/jbehave' using formats '[stats, console, txt, html, xml]' and view properties '

      {decorateNonHtml=true}

      '
      Reports view generated with 5 stories (of which 2 pending) containing 3 scenarios (of which 0 failed and 3 pending)

        Activity

        Hide
        Mauro Talevi added a comment -

        Hi Jon,

        I've added your scenario to the trader pending.story and the problem cannot be reproduced, i.e. And steps are well-handled.

        From the stacktrace the problem is most probably with your configuration, possibly of the keywords. It seems the for some reason the And keyword or step type is not found.

        Can you please provide a little self-contained project that reproduces the problem? Something as simple as the pom.xml and the Stories class and the .story file that you are using.

        Show
        Mauro Talevi added a comment - Hi Jon, I've added your scenario to the trader pending.story and the problem cannot be reproduced, i.e. And steps are well-handled. From the stacktrace the problem is most probably with your configuration, possibly of the keywords. It seems the for some reason the And keyword or step type is not found. Can you please provide a little self-contained project that reproduces the problem? Something as simple as the pom.xml and the Stories class and the .story file that you are using.
        Mauro Talevi made changes -
        Field Original Value New Value
        Comment [ Hi Jon,

        I've added your scenario to the trader pending.story and the problem cannot be reproduced, i.e. And steps are well-handled.

        From the stacktrace the problem is most probably with your configuration, possibly of the keywords. It seems the for some reason the And keyword or step type is not found.

        Can you please provide a little self-contained project that reproduces the problem? Something as simple as the pom.xml and the Stories class and the .story file that you are using.
        ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 3.3.2 [ 17308 ]
        Affects Version/s 3.4 [ 17278 ]
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Mauro Talevi added a comment -

        Was able to reproduce it from the unit level behaviour. Not sure yet why the example does not show it though.

        Show
        Mauro Talevi added a comment - Was able to reproduce it from the unit level behaviour. Not sure yet why the example does not show it though.
        Mauro Talevi made changes -
        Fix Version/s 3.4 [ 17278 ]
        Hide
        Mauro Talevi added a comment -

        Mystery solved: the problem manifested itself only if there are no step candidates, i.e. no annotated methods in your Steps class.

        In any case, the mechanism to look for the previous non-And step has now been refactored to not depend on the presence of step candidates.

        Show
        Mauro Talevi added a comment - Mystery solved: the problem manifested itself only if there are no step candidates, i.e. no annotated methods in your Steps class. In any case, the mechanism to look for the previous non-And step has now been refactored to not depend on the presence of step candidates.
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Jonathan Woods
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: