Package org.jbehave.core.configuration

Examples of org.jbehave.core.configuration.Configuration


    }

    @Test
    public void shouldListCandidateStepsFromAnnotatedMethodsInPojo() {
        PojoSteps steps = new PojoSteps();
        Configuration configuration = new MostUsefulConfiguration();
    List<StepCandidate> candidates = new InstanceStepsFactory(configuration, steps).createCandidateSteps().get(0).listCandidates();
        assertThat(candidates.size(), equalTo(6));

        findCandidate(candidates, "GIVEN a given").createMatchedStep("Given a given", tableRow).perform(null);
        findCandidate(candidates, "GIVEN a given alias").createMatchedStep("Given a given alias", tableRow).perform(null);
View Full Code Here


        assertThat(step.toString(), Matchers.containsString(stepMonitor.getClass().getName()));
    }

    @Test
    public void shouldAllowLocalizationOfSteps(){
        Configuration configuration = new MostUsefulConfiguration();
        configuration.useKeywords(new LocalizedKeywords(new Locale("it")));
      LocalizedSteps steps = new LocalizedSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(3));

        findCandidate(candidates, "GIVEN un dato che").createMatchedStep("Dato che un dato che", tableRow).perform(null);
View Full Code Here

    }

    @Test(expected=StartingWordNotFound.class)
    public void shouldNotCreateStepIfStartingWordNotFound(){
        Configuration configuration = new MostUsefulConfiguration();
        configuration.useKeywords(new LocalizedKeywords(new Locale("it")));
      LocalizedSteps steps = new LocalizedSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(3));

        // misspelled starting word
View Full Code Here

        }
    }

    @Test
    public void shouldPerformStepsInDryRunMode() {
        Configuration configuration = new MostUsefulConfiguration();
        configuration.storyControls().doDryRun(true);
        NamedTypeSteps steps = new NamedTypeSteps(configuration);
        List<StepCandidate> candidates = steps.listCandidates();
        assertThat(candidates.size(), equalTo(2));
        StepCandidate step0 = candidateMatchingStep(candidates, "Given foo named $name");
        step0.createMatchedStep("Given foo named xyz", namedParameters).perform(null);
View Full Code Here

    StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
        .withCodeLocation(codeLocation)
        .withDefaultFormats()
        .withFormats(CONSOLE, TXT, HTML, XML);

    Configuration config = new MostUsefulConfiguration()
        .useStoryLoader(storyLoader)
        .useStoryReporterBuilder(reporterBuilder);

    return config;
  }
View Full Code Here

        StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
                .withCodeLocation(CodeLocations.codeLocationFromClass(EtsyDotComStories.class)).withFailureTrace(true)
                .withFailureTraceCompression(true).withDefaultFormats().withFormats(formats)
                .withCrossReference(crossReference);

        Configuration configuration = new SeleniumConfiguration().useWebDriverProvider(driverProvider)
                .useSeleniumContext(seleniumContext).useFailureStrategy(new RethrowingFailure())
                .usePendingStepStrategy(pendingStepStrategy)
                .useStoryControls(new StoryControls().doResetStateBeforeScenario(false))
                .useStepMonitor(new SeleniumStepMonitor(contextView, seleniumContext, crossReference.getStepMonitor()))
                .useStoryLoader(new LoadFromClasspath(EtsyDotComStories.class))
                .useStoryReporterBuilder(reporterBuilder);
        useConfiguration(configuration);

        final ThreadCaching primordialCaching = new ThreadCaching();
        MutablePicoContainer primordial = new PicoBuilder().withBehaviors(primordialCaching).build();
        primordial.addComponent(WebDriverProvider.class, driverProvider);

        // Groovy Steps - can be stateful per story.
        final Storing store = (Storing) new Storing().wrap(new CompositeInjection(new ConstructorInjection(),
                new SetterInjection("set", "setMetaClass")));
        ClassLoader currentClassLoader = this.getClass().getClassLoader();
        final DefaultClassLoadingPicoContainer pageObjects = new DefaultClassLoadingPicoContainer(currentClassLoader,
                store, primordial);
        pageObjects.change(Characteristics.USE_NAMES);
        // This loads all the Groovy page objects - can be stateful
        pageObjects.visit(new ClassName("pages.Home"), ".*\\.class", true,
                new DefaultClassLoadingPicoContainer.ClassVisitor() {
                    public void classFound(@SuppressWarnings("rawtypes") Class clazz) {
                        pageObjects.addComponent(clazz);
                    }
                });

        ClassLoadingPicoContainer steps = pageObjects.makeChildContainer("steps");
        steps.addComponent(new CacheFlusher(store));
        steps.addComponent(new ClassName("HousekeepingSteps"));
        steps.addComponent(new ClassName("EtsyDotComSteps"));
        // Before And After Steps registered by instance
        steps.addComponent(new PerStoryWebDriverSteps(driverProvider));
        steps.addComponent(new WebDriverScreenshotOnFailure(driverProvider, configuration.storyReporterBuilder()));
        // steps.addComponent(new WebDriverPageDumpOnFailure(driverProvider,
        // configuration.storyReporterBuilder()));
        steps.addComponent(new PerStoriesContextView(contextView));
        useStepsFactory(new PicoStepsFactory(configuration, steps));

View Full Code Here

        StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
                .withCodeLocation(codeLocationFromClass(EtsyDotComStories.class)).withFailureTrace(true)
                .withFailureTraceCompression(true).withDefaultFormats().withFormats(formats)
                .withCrossReference(crossReference);

        Configuration configuration = injectedEmbedder().configuration();
        configuration.useFailureStrategy(new FailingUponPendingStep())
                .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)).useStepMonitor(stepMonitor)
                .useStoryLoader(new LoadFromClasspath(EtsyDotComStories.class))
                .useStoryReporterBuilder(reporterBuilder);
        if (configuration instanceof SeleniumConfiguration) {
            SeleniumConfiguration seleniumConfiguration = (SeleniumConfiguration) configuration;
View Full Code Here

    StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
        .withCodeLocation(codeLocationFromClass(this.getClass())).withFailureTrace(true)
        .withFailureTraceCompression(true).withDefaultFormats().withFormats(formats)
        .withCrossReference(crossReference);

    Configuration configuration = new SeleniumConfiguration().useSeleniumContext(seleniumContext)
        .useFailureStrategy(new FailingUponPendingStep())
        .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)).useStepMonitor(stepMonitor)
        .useStoryLoader(new LoadFromClasspath(this.getClass()))
        .useStoryReporterBuilder(reporterBuilder);
    useConfiguration(configuration);
View Full Code Here

TOP

Related Classes of org.jbehave.core.configuration.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.