Search in sources :

Example 6 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder in project jbehave-core by jbehave.

the class CoreStoryMaps method configuration.

@Override
public Configuration configuration() {
    TableTransformers tableTransformers = new TableTransformers();
    ExamplesTableFactory tableFactory = new ExamplesTableFactory(new LoadFromClasspath(this.getClass()), tableTransformers);
    return new MostUsefulConfiguration().useStoryParser(new RegexStoryParser(tableFactory)).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass()))).useTableTransformers(tableTransformers);
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) RegexStoryParser(org.jbehave.core.parsers.RegexStoryParser) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ExamplesTableFactory(org.jbehave.core.model.ExamplesTableFactory) TableTransformers(org.jbehave.core.model.TableTransformers)

Example 7 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder in project jbehave-core by jbehave.

the class MyStories method configuration.

@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    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().useStoryLoader(resourceLoader).useStoryParser(new RegexStoryParser(examplesTableFactory)).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass)).withDefaultFormats().withFormats(CONSOLE, TXT, HTML, XML)).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) TableTransformers(org.jbehave.core.model.TableTransformers) 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)

Example 8 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder 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());
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) LoadFromURL(org.jbehave.core.io.LoadFromURL) Configuration(org.jbehave.core.configuration.Configuration) ResolveToSimpleName(org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName)

Example 9 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder in project jbehave-core by jbehave.

the class Embedder method generateReportsView.

public void generateReportsView() {
    StoryReporterBuilder builder = configuration().storyReporterBuilder();
    File outputDirectory = builder.outputDirectory();
    List<String> formatNames = builder.formatNames(true);
    generateReportsView(outputDirectory, formatNames, builder.viewResources());
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) File(java.io.File)

Example 10 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder in project jbehave-core by jbehave.

the class Embedder method generateMapsView.

private void generateMapsView(StoryMaps storyMaps) {
    Configuration configuration = configuration();
    StoryReporterBuilder builder = configuration.storyReporterBuilder();
    File outputDirectory = builder.outputDirectory();
    Properties viewResources = builder.viewResources();
    ViewGenerator viewGenerator = configuration.viewGenerator();
    try {
        embedderMonitor.generatingMapsView(outputDirectory, storyMaps, viewResources);
        viewGenerator.generateMapsView(outputDirectory, storyMaps, viewResources);
    } catch (RuntimeException e) {
        embedderMonitor.mapsViewGenerationFailed(outputDirectory, storyMaps, viewResources, e);
        throw new ViewGenerationFailed(outputDirectory, storyMaps, viewResources, e);
    }
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) Configuration(org.jbehave.core.configuration.Configuration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) ViewGenerator(org.jbehave.core.reporters.ViewGenerator) Properties(java.util.Properties) File(java.io.File)

Aggregations

StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)20 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)12 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)8 TableTransformers (org.jbehave.core.model.TableTransformers)8 Properties (java.util.Properties)7 ParameterConverters (org.jbehave.core.steps.ParameterConverters)7 Configuration (org.jbehave.core.configuration.Configuration)6 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)5 RegexStoryParser (org.jbehave.core.parsers.RegexStoryParser)5 File (java.io.File)4 SimpleDateFormat (java.text.SimpleDateFormat)4 MarkUnmatchedStepsAsPending (org.jbehave.core.steps.MarkUnmatchedStepsAsPending)4 DateConverter (org.jbehave.core.steps.ParameterConverters.DateConverter)4 StoryControls (org.jbehave.core.embedder.StoryControls)3 SilentlyAbsorbingFailure (org.jbehave.core.failures.SilentlyAbsorbingFailure)3 ExamplesTableFactory (org.jbehave.core.model.ExamplesTableFactory)3 ParameterControls (org.jbehave.core.steps.ParameterControls)3 FileNotFoundException (java.io.FileNotFoundException)2 Produces (javax.enterprise.inject.Produces)2 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)2