Search in sources :

Example 1 with SilentlyAbsorbingFailure

use of org.jbehave.core.failures.SilentlyAbsorbingFailure 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();
    }
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) StepFinder(org.jbehave.core.steps.StepFinder) Configuration(org.jbehave.core.configuration.Configuration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Embedder(org.jbehave.core.embedder.Embedder) FileNotFoundException(java.io.FileNotFoundException) SilentlyAbsorbingFailure(org.jbehave.core.failures.SilentlyAbsorbingFailure) ByLevenshteinDistance(org.jbehave.core.steps.StepFinder.ByLevenshteinDistance) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) InstanceStepsFactory(org.jbehave.core.steps.InstanceStepsFactory) EmbedderControls(org.jbehave.core.embedder.EmbedderControls) MarkUnmatchedStepsAsPending(org.jbehave.core.steps.MarkUnmatchedStepsAsPending)

Example 2 with SilentlyAbsorbingFailure

use of org.jbehave.core.failures.SilentlyAbsorbingFailure 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();
    }
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) StepFinder(org.jbehave.core.steps.StepFinder) Configuration(org.jbehave.core.configuration.Configuration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Embedder(org.jbehave.core.embedder.Embedder) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) SilentlyAbsorbingFailure(org.jbehave.core.failures.SilentlyAbsorbingFailure) ByLevenshteinDistance(org.jbehave.core.steps.StepFinder.ByLevenshteinDistance) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) InstanceStepsFactory(org.jbehave.core.steps.InstanceStepsFactory) EmbedderControls(org.jbehave.core.embedder.EmbedderControls) MarkUnmatchedStepsAsPending(org.jbehave.core.steps.MarkUnmatchedStepsAsPending)

Example 3 with SilentlyAbsorbingFailure

use of org.jbehave.core.failures.SilentlyAbsorbingFailure in project jbehave-core by jbehave.

the class ConfigurationProducer method getConfiguration.

@Produces
@WeldConfiguration
Configuration getConfiguration() {
    Properties viewResources = new Properties();
    viewResources.setProperty("index", "my-reports-index.ftl");
    viewResources.setProperty("decorateNonHtml", "true");
    TableTransformers tableTransformers = new TableTransformers();
    LoadFromURL resourceLoader = new LoadFromURL();
    return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(true).doSkipScenariosAfterFailure(true)).useFailureStrategy(new SilentlyAbsorbingFailure()).useStoryLoader(resourceLoader).useStepPatternParser(new RegexPrefixCapturingPatternParser("MyPrefix")).useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(CONSOLE, HTML, TXT, XML).withKeywords(new LocalizedKeywords(Locale.ITALIAN)).withRelativeDirectory("my-output-directory").withViewResources(viewResources).withFailureTrace(true)).useParameterConverters(new ParameterConverters(resourceLoader, tableTransformers).addConverters(new CustomConverter(), new MyDateConverter())).useTableTransformers(tableTransformers);
}
Also used : SilentlyAbsorbingFailure(org.jbehave.core.failures.SilentlyAbsorbingFailure) RegexPrefixCapturingPatternParser(org.jbehave.core.parsers.RegexPrefixCapturingPatternParser) StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) LoadFromURL(org.jbehave.core.io.LoadFromURL) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ParameterConverters(org.jbehave.core.steps.ParameterConverters) LocalizedKeywords(org.jbehave.core.i18n.LocalizedKeywords) StoryControls(org.jbehave.core.embedder.StoryControls) Properties(java.util.Properties) TableTransformers(org.jbehave.core.model.TableTransformers) Produces(javax.enterprise.inject.Produces) WeldConfiguration(org.jbehave.core.annotations.weld.WeldConfiguration)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)3 SilentlyAbsorbingFailure (org.jbehave.core.failures.SilentlyAbsorbingFailure)3 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)3 FileNotFoundException (java.io.FileNotFoundException)2 Configuration (org.jbehave.core.configuration.Configuration)2 Embedder (org.jbehave.core.embedder.Embedder)2 EmbedderControls (org.jbehave.core.embedder.EmbedderControls)2 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)2 InstanceStepsFactory (org.jbehave.core.steps.InstanceStepsFactory)2 MarkUnmatchedStepsAsPending (org.jbehave.core.steps.MarkUnmatchedStepsAsPending)2 StepFinder (org.jbehave.core.steps.StepFinder)2 ByLevenshteinDistance (org.jbehave.core.steps.StepFinder.ByLevenshteinDistance)2 IOException (java.io.IOException)1 Properties (java.util.Properties)1 Produces (javax.enterprise.inject.Produces)1 WeldConfiguration (org.jbehave.core.annotations.weld.WeldConfiguration)1 StoryControls (org.jbehave.core.embedder.StoryControls)1 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)1 LoadFromURL (org.jbehave.core.io.LoadFromURL)1 TableTransformers (org.jbehave.core.model.TableTransformers)1