JBehave
  1. JBehave
  2. JBEHAVE-548

Add support for annotated steps before and after example scenarios

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.5
    • Fix Version/s: 3.5
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      1

      Description

      It would be nice to have annotations (or any other way) to run some methods before and after each example.

        Activity

        Hide
        Lance added a comment -

        As an addition to this, it would be good to add an afterExample() method to org.jbehave.core.reporters.StoryReporter. There is currently only a hook at afterExamples()

        Show
        Lance added a comment - As an addition to this, it would be good to add an afterExample() method to org.jbehave.core.reporters.StoryReporter. There is currently only a hook at afterExamples()
        Hide
        Lance added a comment -

        You can use the JUnitTestRunner that I have attached to jira JBEHAVE-551 which supports new @BeforeExample and @AfterExample annotations.

        Show
        Lance added a comment - You can use the JUnitTestRunner that I have attached to jira JBEHAVE-551 which supports new @BeforeExample and @AfterExample annotations.
        Hide
        Dennis Becker added a comment -

        I thought this behaviour has been implemented by the @AfterScneraio and @BeforeScenario annotations, because every example is an scenario of it's own.

        Maybe extend the way @AfterScenario and @BeforeScenario works or implement @AfterExample and @BeforeExample.

        Show
        Dennis Becker added a comment - I thought this behaviour has been implemented by the @AfterScneraio and @BeforeScenario annotations, because every example is an scenario of it's own. Maybe extend the way @AfterScenario and @BeforeScenario works or implement @AfterExample and @BeforeExample.
        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.5 [ 17393 ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Mauro Talevi made changes -
        Summary @BeforeExample und @AfterExample Add support for annotated steps before and after example scenarios
        Hide
        Erich Eichinger added a comment -

        Attached StoryRunner implementation runs before/after scenario steps also before/after each example

        Show
        Erich Eichinger added a comment - Attached StoryRunner implementation runs before/after scenario steps also before/after each example
        Erich Eichinger made changes -
        Attachment FixedStoryRunner.java [ 56740 ]
        Hide
        Mauro Talevi added a comment -

        Erich,

        this feature has already been implemented in this commit:

        https://github.com/jbehave/jbehave-core/commit/c33497bfd2cb78eb655f72d5f3a6d9c4aefc3575

        Please pull latest snapshot and let me know if it works for you.

        The trader example has been update to have steps executed before and after example scenarios (see BeforeAfterSteps)

        Cheers

        Show
        Mauro Talevi added a comment - Erich, this feature has already been implemented in this commit: https://github.com/jbehave/jbehave-core/commit/c33497bfd2cb78eb655f72d5f3a6d9c4aefc3575 Please pull latest snapshot and let me know if it works for you. The trader example has been update to have steps executed before and after example scenarios (see BeforeAfterSteps) Cheers
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Andreas Ebbert-Karroum
          • Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: