JBehave
  1. JBehave
  2. JBEHAVE-933

timeout should be applied to stories only

    Details

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

      Description

      Hi,

      as I read the specification of a timeout, it is setting the controls to let a story time out, when a specified amount of time has passed. By the name this is a setting per story. So, when I have a timeout of 300s per story, I should be able to have 100 stories, which take 250 seconds each.

      The way it is implemented is different, though. The StoryManager measures the start time right after it kicked off all stories, and is waiting for all of them to be completed.

      https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java

          public void waitUntilAllDoneOrFailed(BatchFailures failures) {
              long start = System.currentTimeMillis();
              boolean allDone = false;
              while (!allDone) {
                  allDone = true;
                  for (RunningStory runningStory : runningStories.values()) {
                      Future<ThrowableStory> future = runningStory.getFuture();
                      if (!future.isDone()) {
                          allDone = false;
                          long durationInSecs = storyDurationInSecs(start);
                          long timeoutInSecs = embedderControls.storyTimeoutInSecs();
                          if (durationInSecs > timeoutInSecs) {
                              Story story = runningStory.getStory();
                              StoryDuration storyDuration = new StoryDuration(durationInSecs, timeoutInSecs);
                              embedderMonitor.storyTimeout(story, storyDuration);
                              storyRunner.cancelStory(story, storyDuration);
                              future.cancel(true);
                          }
                          break;
                      }
      

        Activity

        Hide
        Christopher Aguirre added a comment -

        Has this been resolved with JBEHAVE-1037 ?

        Show
        Christopher Aguirre added a comment - Has this been resolved with JBEHAVE-1037 ?
        Hide
        Mauro Talevi added a comment -

        Yes

        Show
        Mauro Talevi added a comment - Yes
        Hide
        Christopher Aguirre added a comment -

        Confirmed by Mauro - fixed in 3.9.4 and latest 4.0 beta

        Show
        Christopher Aguirre added a comment - Confirmed by Mauro - fixed in 3.9.4 and latest 4.0 beta

          People

          • Assignee:
            Unassigned
            Reporter:
            Andreas Ebbert-Karroum
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: