JBehave
  1. JBehave
  2. JBEHAVE-746

ReportsCount is counting files that aren't stories in the story count

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.4
    • Fix Version/s: 3.6
    • Component/s: Core
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      Problem Statement:
      When running the JBehave tests, the ReportsCount that is output to the JUnit console is counting non-story Reports.

      Example:
      This is what the code currently returns:
      org.jbehave.core.embedder.Embedder$RunningStoriesFailed: Failures in running stories: ReportsCount[stories=9,storiesNotAllowed=0,storiesPending=0,scenarios=1,scenariosFailed=1,scenariosNotAllowed=0,scenariosPending=0,stepsFailed=1]

      Proposed change:
      Change line 121 of the TemplateViewGenerator to use a method that filters out Reports that don't have any scenarios.

      current : int stories = reports.size();
      proposed: int stories = storyCount();

      private int storyCount(){
      int storyCount = 0;
      for (Report report : reports){
      if (report.getStats().containsKey("scenarios"))

      { if (report.getStats().get("scenarios") > 0) storyCount++; }

      }
      return storyCount;
      }

      Results after change:
      org.jbehave.core.embedder.Embedder$RunningStoriesFailed: Failures in running stories: ReportsCount[stories=1,storiesNotAllowed=0,storiesPending=0,scenarios=1,scenariosFailed=1,scenariosNotAllowed=0,scenariosPending=0,stepsFailed=1]

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.6 [ 17721 ]
        Affects Version/s 3.5.4 [ 18081 ]
        Affects Version/s web-3.4.3 [ 18124 ]
        Hide
        Mauro Talevi added a comment -

        Applied patch with thanks.

        Show
        Mauro Talevi added a comment - Applied patch with thanks.
        Mauro Talevi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            David Tanner
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified