commit c2f1548f0d48a301fed36d33208ab84fa62efeb5
Author:     Mauro Talevi <mauro.tal...@aquilonia.org>
AuthorDate: Mon, 28 Jul 2014 18:05:43 +0100
Commit:     Mauro Talevi <mauro.tal...@aquilonia.org>
CommitDate: Mon, 28 Jul 2014 18:05:43 +0100

    JBEHAVE-1035:  Ensure @BeforeStory steps are performed before the 
GivenStories.

diff --git 
a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java 
b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
index 6a2345e..3247b10 100644
--- a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
@@ -715,8 +715,10 @@ public class PerformableTree {
             State state = context.state();
             Timer timer = new Timer().start();
             try {
+                beforeSteps.perform(context);
                performGivenStories(context);
                 performScenarios(context);
+                afterSteps.perform(context);
             } finally {
                 timing.setDurationInMillis(timer.stop());
             }
@@ -735,11 +737,9 @@ public class PerformableTree {
                }
                
         private void performScenarios(RunContext context) throws 
InterruptedException {
-            beforeSteps.perform(context);
             for (PerformableScenario scenario : scenarios) {
                 scenario.perform(context);
             }
-            afterSteps.perform(context);
         }
 
         public List<PerformableScenario> getScenarios() {



Reply via email to