Search in sources :

Example 6 with RegexStoryParser

use of org.jbehave.core.parsers.RegexStoryParser in project jbehave-core by jbehave.

the class CoreStory method configuration.

@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    Properties viewResources = new Properties();
    viewResources.put("decorateNonHtml", "true");
    LoadFromClasspath resourceLoader = new LoadFromClasspath(embeddableClass);
    TableTransformers tableTransformers = new TableTransformers();
    ParameterControls parameterControls = new ParameterControls();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters(resourceLoader, tableTransformers);
    // factory to allow parameter conversion and loading from external
    // resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), resourceLoader, parameterConverters, parameterControls, tableTransformers);
    // add custom converters
    parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")), new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(false).doSkipScenariosAfterFailure(false)).useStoryLoader(resourceLoader).useStoryParser(new RegexStoryParser(examplesTableFactory)).useStoryPathResolver(new UnderscoredCamelCaseResolver()).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass)).withDefaultFormats().withPathResolver(new ResolveToPackagedName()).withViewResources(viewResources).withFormats(CONSOLE, TXT, HTML_TEMPLATE, XML).withCrossReference(xref).withFailureTrace(true).withFailureTraceCompression(true)).useParameterConverters(parameterConverters).useParameterControls(parameterControls).useTableTransformers(tableTransformers);
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) ParameterControls(org.jbehave.core.steps.ParameterControls) DateConverter(org.jbehave.core.steps.ParameterConverters.DateConverter) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) LocalizedKeywords(org.jbehave.core.i18n.LocalizedKeywords) ExamplesTableConverter(org.jbehave.core.steps.ParameterConverters.ExamplesTableConverter) StoryControls(org.jbehave.core.embedder.StoryControls) Properties(java.util.Properties) TableTransformers(org.jbehave.core.model.TableTransformers) UnderscoredCamelCaseResolver(org.jbehave.core.io.UnderscoredCamelCaseResolver) RegexStoryParser(org.jbehave.core.parsers.RegexStoryParser) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) ParameterConverters(org.jbehave.core.steps.ParameterConverters) ExamplesTableFactory(org.jbehave.core.model.ExamplesTableFactory) SimpleDateFormat(java.text.SimpleDateFormat) ResolveToPackagedName(org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToPackagedName)

Example 7 with RegexStoryParser

use of org.jbehave.core.parsers.RegexStoryParser in project jbehave-core by jbehave.

the class StoryRunnerBehaviour method configurationWithPendingStrategy.

private Configuration configurationWithPendingStrategy(StepCollector collector, StoryReporter reporter, PendingStepStrategy strategy) {
    LoadFromClasspath resourceLoadder = new LoadFromClasspath();
    RegexStoryParser storyParser = new RegexStoryParser(resourceLoadder, new TableTransformers());
    return configurationWith(storyParser, resourceLoadder, reporter, collector, new RethrowingFailure(), strategy);
}
Also used : RegexStoryParser(org.jbehave.core.parsers.RegexStoryParser) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath)

Example 8 with RegexStoryParser

use of org.jbehave.core.parsers.RegexStoryParser in project jbehave-core by jbehave.

the class StoryRunnerBehaviour method configurationWith.

private Configuration configurationWith(StoryReporter reporter, StepCollector collector, FailureStrategy failureStrategy) {
    LoadFromClasspath resourceLoadder = new LoadFromClasspath();
    RegexStoryParser storyParser = new RegexStoryParser(resourceLoadder, new TableTransformers());
    return configurationWith(storyParser, resourceLoadder, reporter, collector, failureStrategy);
}
Also used : RegexStoryParser(org.jbehave.core.parsers.RegexStoryParser) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath)

Aggregations

RegexStoryParser (org.jbehave.core.parsers.RegexStoryParser)8 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)7 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)5 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)5 TableTransformers (org.jbehave.core.model.TableTransformers)5 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)5 Properties (java.util.Properties)4 ExamplesTableFactory (org.jbehave.core.model.ExamplesTableFactory)4 ParameterControls (org.jbehave.core.steps.ParameterControls)4 ParameterConverters (org.jbehave.core.steps.ParameterConverters)4 SimpleDateFormat (java.text.SimpleDateFormat)3 DateConverter (org.jbehave.core.steps.ParameterConverters.DateConverter)3 ExamplesTableConverter (org.jbehave.core.steps.ParameterConverters.ExamplesTableConverter)3 Keywords (org.jbehave.core.configuration.Keywords)2 MarkUnmatchedStepsAsPending (org.jbehave.core.steps.MarkUnmatchedStepsAsPending)2 URL (java.net.URL)1 Locale (java.util.Locale)1 Configuration (org.jbehave.core.configuration.Configuration)1 StoryControls (org.jbehave.core.embedder.StoryControls)1 UnderscoredCamelCaseResolver (org.jbehave.core.io.UnderscoredCamelCaseResolver)1