JBehave
  1. JBehave
  2. JBEHAVE-1046

FailingUponPendingSteps strategy not honoured

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.9.4
    • Fix Version/s: 3.9.5
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Mac OSX
    • Number of attachments :
      0

      Description

      When I run a story, JBehave exits without waiting for the story results.

      The same stories work perfectly in version 3.9.3.

        Activity

        Hide
        Mohsen Hariri added a comment -

        I tracked down the problem and it resides in jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java:

            public void waitUntilAllDoneOrFailed(BatchFailures failures) {
                boolean allDone = false;
                while (!allDone) {
                    allDone = true;
                    for (RunningStory runningStory : runningStories.values()) {                 
                        if ( runningStory.isStarted() ){
                            Story story = runningStory.getStory();
                                                Future<ThrowableStory> future = runningStory.getFuture();
                                                if (!future.isDone()) {
                                                        allDone = false;
        

        In the above code, the if ( runningStory.isStarted() ){ does not have any else, so if the stories have not yet started, allDone is left true and JBehave exits without waiting for the stories to finish running.

        Show
        Mohsen Hariri added a comment - I tracked down the problem and it resides in jbehave-core/src/main/java/org/jbehave/core/embedder/ StoryManager .java: public void waitUntilAllDoneOrFailed(BatchFailures failures) { boolean allDone = false ; while (!allDone) { allDone = true ; for (RunningStory runningStory : runningStories.values()) { if ( runningStory.isStarted() ){ Story story = runningStory.getStory(); Future<ThrowableStory> future = runningStory.getFuture(); if (! future .isDone()) { allDone = false ; In the above code, the if ( runningStory.isStarted() ){ does not have any else , so if the stories have not yet started, allDone is left true and JBehave exits without waiting for the stories to finish running.
        Hide
        Mauro Talevi added a comment -

        Can you please provide an example of running stories not being started?

        The assumption is that at least one story has started. Otherwise, we can add a wait for at least one to start.

        Show
        Mauro Talevi added a comment - Can you please provide an example of running stories not being started? The assumption is that at least one story has started. Otherwise, we can add a wait for at least one to start.
        Hide
        Mohsen Hariri added a comment -

        I ran the following story without any Steps implementation:

        Feature: Login
        
        Narrative:
        In order to use the system, one needs to login and identify herself
        to the system
        
        Scenario:  Login page
        When user browses to http://localhost:1090/
        Then the login page appears
        

        I had configured the runner to complain about the non-existing implementations:

        embedder.configuration().usePendingStepStrategy(new FailingUponPendingStep());
        

        Expected behaviour: build should fail with that configuration
        Actual behaviour: it always succeeded
        JBehave version: jbehave-ant 3.9.4

        More details:
        I did not get any failures, so I started debugging JBehave. When tracing, sometimes I got the error, so I guessed it was a timing issue. Debugging more and I came into the place I pasted above. Then I used the 3.9.3 version and the build always failed with that version, as expected.

        Show
        Mohsen Hariri added a comment - I ran the following story without any Steps implementation: Feature: Login Narrative: In order to use the system, one needs to login and identify herself to the system Scenario: Login page When user browses to http: //localhost:1090/ Then the login page appears I had configured the runner to complain about the non-existing implementations: embedder.configuration().usePendingStepStrategy( new FailingUponPendingStep()); Expected behaviour: build should fail with that configuration Actual behaviour: it always succeeded JBehave version: jbehave-ant 3.9.4 More details: I did not get any failures, so I started debugging JBehave. When tracing, sometimes I got the error, so I guessed it was a timing issue. Debugging more and I came into the place I pasted above. Then I used the 3.9.3 version and the build always failed with that version, as expected.
        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.9.5 [ 20598 ]
        Summary JBehave exits immaturely FailingUponPendingSteps strategy not honoured
        Hide
        Mauro Talevi added a comment -

        Added examples/core/src/main/java/org/jbehave/examples/core/CoreStoriesFailingUponPending.java to verify behaviour.

        Show
        Mauro Talevi added a comment - Added examples/core/src/main/java/org/jbehave/examples/core/CoreStoriesFailingUponPending.java to verify behaviour.
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Assignee Mauro Talevi [ maurotalevi ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Mohsen Hariri
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: