[ 
http://jira.codehaus.org/browse/JBEHAVE-429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=255859#action_255859
 ] 

Paul Hammant commented on JBEHAVE-429:
--------------------------------------

The following will do it. There's no broken unit-tests for this :-(
I can confirm that the purposefully broken Etsy (Cart can't find selector) with 
a change to PerScenarioWebDriver works as would be hoped for.

.......................


--- 
a/jbehave-core/src/main/java/org/jbehave/core/steps/MarkUnmatchedStepsAsPending.java
+++ 
b/jbehave-core/src/main/java/org/jbehave/core/steps/MarkUnmatchedStepsAsPending.java
@@ -44,15 +44,17 @@ public class MarkUnmatchedStepsAsPending implements 
StepCollector {
        }
 
     public List<Step> collectBeforeOrAfterScenarioSteps(List<CandidateSteps> 
candidateSteps, Stage stage, boolean failureO
-        List<Step> steps = new ArrayList<Step>();
+        List<Step> beforeSteps = new ArrayList<Step>();
+        List<Step> afterSteps = new ArrayList<Step>();
         for (CandidateSteps candidates : candidateSteps) {
             List<BeforeOrAfterStep> beforeOrAfterScenarioSteps = 
candidates.listBeforeOrAfterScenario();
             if (stage == Stage.BEFORE)
-                steps.addAll(createSteps(beforeOrAfterScenarioSteps, stage));
+                beforeSteps.addAll(createSteps(beforeOrAfterScenarioSteps, 
stage));
             else
-                
steps.addAll(createStepsUponOutcome(beforeOrAfterScenarioSteps, stage, 
failureOccured));
+                afterSteps.addAll(0, 
createStepsUponOutcome(beforeOrAfterScenarioSteps, stage, failureOccured));
         }
-
+        List<Step> steps = new ArrayList<Step>(beforeSteps);
+        steps.addAll(afterSteps);
         return steps;
     }


> @AfterScenario should execute in reverse order to @BeforeScenario
> -----------------------------------------------------------------
>
>                 Key: JBEHAVE-429
>                 URL: http://jira.codehaus.org/browse/JBEHAVE-429
>             Project: JBehave
>          Issue Type: Bug
>            Reporter: Paul Hammant
>
> Consider WebDriver situations, where the order below is nearly always going 
> to be the case:
>   new PerStoriesWebDriverSteps(..),
>   new PerStoriesContextView(..), 
>   new WebDriverScreenshotOnFailure(..)
> If we change from PerStoriesWebDriverSteps to PerScenarioWebDriverSteps, then 
> we have a problem. PerScenarioWebDriverSteps could conceivable drop the 
> reference to WebDriver after closing it, and cause 
> WebDriverScreenshotOnFailure to fail when it's needing to leap into action.
> The reproduction involved making steps fail, and making the 
> PerStoriesWebDriverSteps to PerScenarioWebDriverSteps change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to