29 Apr 2012 11:16
[scm-tutorial][1] Updated to use pending step strategy in the xref.
dt:after { content: ':' !important; }
>Commit
a6d3b8e7bd8ccf2958ea076030a983df242d95b8
Branch
master
Author
Mauro Talevi <mauro.talevi-hQ+s5KbX5YmGglJvpFV4uA@public.gmane.org>
Date
Sun Apr 29 11:15:55 2012 +0200
Message
Updated to use pending step strategy in the xref.
Changed file etsy-selenium/groovy-pico/src/main/java/org/jbehave/tutorials/etsy/EtsyDotComStories.java
| 1 | 1 | package org.jbehave.tutorials.etsy; |
| 2 | 2 | |
| 3 | import java.util.HashMap; | |
| 4 | import java.util.List; | |
| 5 | ||
| 3 | 6 | import org.jbehave.core.annotations.AfterStories; |
| 4 | 7 | import org.jbehave.core.annotations.BeforeStory; |
| 5 | 8 | import org.jbehave.core.configuration.Configuration; |
| 6 | 9 | import org.jbehave.core.embedder.StoryControls; |
| 7 | 10 | import org.jbehave.core.failures.FailingUponPendingStep; |
| 11 | import org.jbehave.core.failures.PendingStepStrategy; | |
| 8 | 12 | import org.jbehave.core.failures.RethrowingFailure; |
| 9 | 13 | import org.jbehave.core.io.CodeLocations; |
| 10 | 14 | import org.jbehave.core.io.LoadFromClasspath; |
| … | ||
| 40 | 44 | import org.picocontainer.injectors.ConstructorInjection; |
| 41 | 45 | import org.picocontainer.injectors.SetterInjection; |
| 42 | 46 | |
| 43 | import java.util.HashMap; | |
| 44 | import java.util.List; | |
| 45 | ||
| 46 | 47 | import static java.util.Arrays.asList; |
| 47 | 48 | import static org.jbehave.core.io.CodeLocations.codeLocationFromClass; |
| 48 | 49 | import static org.jbehave.core.reporters.Format.CONSOLE; |
| 49 | 50 | import static org.jbehave.web.selenium.WebDriverHtmlOutput.WEB_DRIVER_HTML; |
| 50 | 51 | |
| 51 | //import org.jbehave.web.selenium.WebDriverPageDumpOnFailure; | |
| 52 | ||
| 53 | 52 | public class EtsyDotComStories extends JUnitStories { |
| 54 | 53 | |
| 55 | 54 | private String metaFilter; |
| 56 | 55 | |
| 57 | 56 | public EtsyDotComStories() { |
| 58 | 57 | |
| 59 | final java.util.Map<String, String> storyToSauceUrlMap = new HashMap<String, String>(); | |
| 60 | ||
| 61 | CrossReference crossReference = new SauceContextOutput.SauceLabsCrossReference(storyToSauceUrlMap) { | |
| 58 | PendingStepStrategy pendingStepStrategy = new FailingUponPendingStep(); | |
| 59 | CrossReference crossReference = new SauceContextOutput.SauceLabsCrossReference(new HashMap<String, String>()) { | |
| 62 | 60 | public String getMetaFilter() { |
| 63 | 61 | return metaFilter; |
| 64 | 62 | } |
| 65 | ||
| 66 | }.withJsonOnly() | |
| 67 | .withOutputAfterEachStory(true) | |
| 68 | .markPendingStepsAsFailedStories() | |
| 63 | }.withJsonOnly().withOutputAfterEachStory(true).withPendingStepStrategy(pendingStepStrategy) | |
| 69 | 64 | .excludingStoriesWithNoExecutedScenarios(true); |
| 70 | 65 | |
| 71 | 66 | SeleniumContext seleniumContext = new SeleniumContext(); |
| … | ||
| 77 | 72 | driverProvider = new SauceWebDriverProvider(); |
| 78 | 73 | formats = new Format[] { new SeleniumContextOutput(seleniumContext), CONSOLE, WEB_DRIVER_HTML }; |
| 79 | 74 | contextView = new SauceLabsContextView(driverProvider); |
| 80 | crossReference.withThreadSafeDelegateFormat(new SauceContextOutput(driverProvider, seleniumContext, storyToSauceUrlMap)); | |
| 75 | crossReference.withThreadSafeDelegateFormat(new SauceContextOutput(driverProvider, seleniumContext, | |
| 76 | new HashMap<String, String>())); | |
| 81 | 77 | } else if (System.getProperty("REMOTE") != null) { |
| 82 | 78 | driverProvider = new RemoteWebDriverProvider(); |
| 83 | 79 | formats = new Format[] { CONSOLE, WEB_DRIVER_HTML }; |
| … | ||
| 94 | 90 | .withCrossReference(crossReference); |
| 95 | 91 | |
| 96 | 92 | Configuration configuration = new SeleniumConfiguration().useWebDriverProvider(driverProvider) |
| 97 | .useSeleniumContext(seleniumContext) | |
| 98 | .useFailureStrategy(new RethrowingFailure()) | |
| 99 | .usePendingStepStrategy(new FailingUponPendingStep()) | |
| 93 | .useSeleniumContext(seleniumContext).useFailureStrategy(new RethrowingFailure()) | |
| 94 | .usePendingStepStrategy(pendingStepStrategy) | |
| 100 | 95 | .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)) |
| 101 | 96 | .useStepMonitor(new SeleniumStepMonitor(contextView, seleniumContext, crossReference.getStepMonitor())) |
| 102 | 97 | .useStoryLoader(new LoadFromClasspath(EtsyDotComStories.class)) |
| … | ||
| 111 | 106 | final Storing store = (Storing) new Storing().wrap(new CompositeInjection(new ConstructorInjection(), |
| 112 | 107 | new SetterInjection("set", "setMetaClass"))); |
| 113 | 108 | ClassLoader currentClassLoader = this.getClass().getClassLoader(); |
| 114 | final DefaultClassLoadingPicoContainer pageObjects = new DefaultClassLoadingPicoContainer(currentClassLoader, store, primordial); | |
| 109 | final DefaultClassLoadingPicoContainer pageObjects = new DefaultClassLoadingPicoContainer(currentClassLoader, | |
| 110 | store, primordial); | |
| 115 | 111 | pageObjects.change(Characteristics.USE_NAMES); |
| 116 | 112 | // This loads all the Groovy page objects - can be stateful |
| 117 | 113 | pageObjects.visit(new ClassName("pages.Home"), ".*\\.class", true, |
| … | ||
| 128 | 124 | // Before And After Steps registered by instance |
| 129 | 125 | steps.addComponent(new PerStoryWebDriverSteps(driverProvider)); |
| 130 | 126 | steps.addComponent(new WebDriverScreenshotOnFailure(driverProvider, configuration.storyReporterBuilder())); |
| 131 | //steps.addComponent(new WebDriverPageDumpOnFailure(driverProvider, configuration.storyReporterBuilder())); | |
| 127 | // steps.addComponent(new WebDriverPageDumpOnFailure(driverProvider, | |
| 128 | // configuration.storyReporterBuilder())); | |
| 132 | 129 | steps.addComponent(new PerStoriesContextView(contextView)); |
| 133 | 130 | useStepsFactory(new PicoStepsFactory(configuration, steps)); |
| 134 | 131 | |
| … | ||
| 136 | 133 | |
| 137 | 134 | <at> Override |
| 138 | 135 | protected List<String> storyPaths() { |
| 139 | return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/" + System.getProperty("storyFilter", "*") | |
| 140 | + ".story"), null); | |
| 136 | return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), | |
| 137 | asList("**/" + System.getProperty("storyFilter", "*") + ".story"), null); | |
| 141 | 138 | } |
| 142 | 139 | |
| 143 | 140 | public static class PerStoriesContextView { |
| … | ||
| 167 | 164 | } |
| 168 | 165 | } |
| 169 | 166 | |
| 170 | ||
| 171 | ||
| 172 | 167 | } |
Changed file etsy-selenium/java-spring/src/main/java/org/jbehave/tutorials/etsy/EtsyDotComStories.java
| 5 | 5 | import org.jbehave.core.configuration.Configuration; |
| 6 | 6 | import org.jbehave.core.embedder.StoryControls; |
| 7 | 7 | import org.jbehave.core.failures.FailingUponPendingStep; |
| 8 | import org.jbehave.core.failures.PendingStepStrategy; | |
| 8 | 9 | import org.jbehave.core.io.LoadFromClasspath; |
| 9 | 10 | import org.jbehave.core.io.StoryFinder; |
| 10 | 11 | import org.jbehave.core.junit.JUnitStories; |
| … | ||
| 29 | 30 | |
| 30 | 31 | public class EtsyDotComStories extends JUnitStories { |
| 31 | 32 | |
| 32 | CrossReference crossReference = new CrossReference().withJsonOnly().withOutputAfterEachStory(true) | |
| 33 | .excludingStoriesWithNoExecutedScenarios(true); | |
| 33 | PendingStepStrategy pendingStepStrategy = new FailingUponPendingStep(); | |
| 34 | CrossReference crossReference = new CrossReference().withJsonOnly().withPendingStepStrategy(pendingStepStrategy) | |
| 35 | .withOutputAfterEachStory(true).excludingStoriesWithNoExecutedScenarios(true); | |
| 34 | 36 | ContextView contextView = new LocalFrameContextView().sized(640, 120); |
| 35 | 37 | SeleniumContext seleniumContext = new SeleniumContext(); |
| 36 | 38 | SeleniumStepMonitor stepMonitor = new SeleniumStepMonitor(contextView, seleniumContext, |
| … | ||
| 44 | 46 | <at> Override |
| 45 | 47 | public Configuration configuration() { |
| 46 | 48 | return new SeleniumConfiguration().useSeleniumContext(seleniumContext) |
| 47 | .useFailureStrategy(new FailingUponPendingStep()) | |
| 49 | .usePendingStepStrategy(pendingStepStrategy) | |
| 48 | 50 | .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)).useStepMonitor(stepMonitor) |
| 49 | 51 | .useStoryLoader(new LoadFromClasspath(EtsyDotComStories.class)) |
| 50 | 52 | .useStoryReporterBuilder(reporterBuilder); |
| … | ||
| 56 | 58 | return new SpringStepsFactory(configuration(), context); |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | ||
| 60 | 61 | <at> Override |
| 61 | 62 | protected List<String> storyPaths() { |
| 62 | return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/" + System.getProperty("storyFilter", "*") | |
| 63 | + ".story"), null); | |
| 63 | return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), | |
| 64 | asList("**/" + System.getProperty("storyFilter", "*") + ".story"), null); | |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | } |
RSS Feed