use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class ReportTransformBehaviour method runStories.
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats().withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class)).withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder).useFailureStrategy(new SilentlyAbsorbingFailure()).useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class GuiceAnnotationBuilderBehaviour method shouldBuildConfigurationFromAnnotations.
@Test
public void shouldBuildConfigurationFromAnnotations() {
AnnotationBuilder builder = new GuiceAnnotationBuilder(AnnotatedUsingGuice.class);
Configuration configuration = builder.buildConfiguration();
assertThat(configuration.storyControls().dryRun(), is(true));
assertThat(configuration.storyControls().skipScenariosAfterFailure(), is(true));
assertThat(configuration.failureStrategy(), instanceOf(SilentlyAbsorbingFailure.class));
assertThat(configuration.storyLoader(), instanceOf(LoadFromURL.class));
assertThat(configuration.stepPatternParser(), instanceOf(RegexPrefixCapturingPatternParser.class));
assertThat(((RegexPrefixCapturingPatternParser) configuration.stepPatternParser()).getPrefix(), equalTo("MyPrefix"));
assertThatCustomObjectIsConverted(configuration.parameterConverters());
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
assertThat(configuration.storyReporterBuilder().formats(), hasItems(CONSOLE, HTML, TXT, XML, STATS));
Keywords keywords = configuration.storyReporterBuilder().keywords();
assertThat(keywords, instanceOf(LocalizedKeywords.class));
assertThat(((LocalizedKeywords) keywords).getLocale(), equalTo(Locale.ITALIAN));
assertThat(configuration.storyReporterBuilder().outputDirectory().getName(), equalTo("my-output-directory"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("index"), equalTo("my-reports-index.ftl"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("decorateNonHtml"), equalTo("true"));
assertThat(configuration.storyReporterBuilder().reportFailureTrace(), is(true));
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class ReportTransformBehaviour method runStories.
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats().withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class)).withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder).useFailureStrategy(new SilentlyAbsorbingFailure()).useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class CoreStoriesUsingURLs method configuration.
@Override
public Configuration configuration() {
Configuration configuration = super.configuration();
StoryReporterBuilder builder = configuration.storyReporterBuilder();
builder.withPathResolver(new ResolveToSimpleName());
return configuration.useStoryLoader(new LoadFromURL());
}
use of org.jbehave.core.configuration.Configuration in project jbehave-core by jbehave.
the class ExamplesTableFailing method configuration.
@Override
public Configuration configuration() {
Configuration configuration = super.configuration();
configuration.storyControls().doResetStateBeforeScenario(false);
return configuration;
}
Aggregations