Search in sources :

Example 1 with ResolveToSimpleName

use of org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName in project jbehave-core by jbehave.

the class FilePrintStreamFactoryBehaviour method shouldResolveOutputNameFromStoryLocationWithSimpleNameResolver.

@Test
public void shouldResolveOutputNameFromStoryLocationWithSimpleNameResolver() {
    FilePathResolver resolver = new ResolveToSimpleName();
    assertThatOutputNameIs("org/jbehave/examples/trader/stories/my_given.story", "my_given.ext", resolver);
    assertThatOutputNameIs("/org/jbehave/examples/trader/stories/my_given.story", "my_given.ext", resolver);
    assertThatOutputNameIs("my_given.story", "my_given.ext", resolver);
    assertThatOutputNameIs("my_given", "my_given.ext", resolver);
}
Also used : FilePathResolver(org.jbehave.core.reporters.FilePrintStreamFactory.FilePathResolver) ResolveToSimpleName(org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName) Test(org.junit.Test)

Example 2 with ResolveToSimpleName

use of org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName in project jbehave-core by jbehave.

the class LocalizedStories method configuration.

@Override
public Configuration configuration() {
    ClassLoader classLoader = this.getClass().getClassLoader();
    URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
    Keywords keywords = new LocalizedKeywords(locale());
    Properties properties = new Properties();
    properties.setProperty("reports", "ftl/jbehave-reports.ftl");
    properties.setProperty("encoding", "UTF-8");
    LoadFromClasspath resourceLoader = new LoadFromClasspath(classLoader);
    TableTransformers tableTransformers = new TableTransformers();
    ParameterControls parameterControls = new ParameterControls();
    ParameterConverters parameterConverters = new ParameterConverters(resourceLoader, parameterControls, tableTransformers, true).addConverters(customConverters(keywords, resourceLoader, tableTransformers));
    return new MostUsefulConfiguration().useKeywords(keywords).useStepCollector(new MarkUnmatchedStepsAsPending(keywords)).useStoryParser(new RegexStoryParser(keywords, resourceLoader, tableTransformers)).useStoryLoader(resourceLoader).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(codeLocation).withPathResolver(new ResolveToSimpleName()).withDefaultFormats().withFormats(CONSOLE, TXT, HTML, XML).withFailureTrace(false).withViewResources(properties).withKeywords(keywords)).useParameterConverters(parameterConverters).useParameterControls(parameterControls).useTableTransformers(tableTransformers);
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) Keywords(org.jbehave.core.configuration.Keywords) LocalizedKeywords(org.jbehave.core.i18n.LocalizedKeywords) ParameterControls(org.jbehave.core.steps.ParameterControls) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) LocalizedKeywords(org.jbehave.core.i18n.LocalizedKeywords) Properties(java.util.Properties) URL(java.net.URL) TableTransformers(org.jbehave.core.model.TableTransformers) RegexStoryParser(org.jbehave.core.parsers.RegexStoryParser) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) ParameterConverters(org.jbehave.core.steps.ParameterConverters) MarkUnmatchedStepsAsPending(org.jbehave.core.steps.MarkUnmatchedStepsAsPending) ResolveToSimpleName(org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName)

Example 3 with ResolveToSimpleName

use of org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName 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)

Aggregations

ResolveToSimpleName (org.jbehave.core.reporters.FilePrintStreamFactory.ResolveToSimpleName)3 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)2 URL (java.net.URL)1 Properties (java.util.Properties)1 Configuration (org.jbehave.core.configuration.Configuration)1 Keywords (org.jbehave.core.configuration.Keywords)1 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)1 LocalizedKeywords (org.jbehave.core.i18n.LocalizedKeywords)1 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)1 LoadFromURL (org.jbehave.core.io.LoadFromURL)1 TableTransformers (org.jbehave.core.model.TableTransformers)1 RegexStoryParser (org.jbehave.core.parsers.RegexStoryParser)1 FilePathResolver (org.jbehave.core.reporters.FilePrintStreamFactory.FilePathResolver)1 MarkUnmatchedStepsAsPending (org.jbehave.core.steps.MarkUnmatchedStepsAsPending)1 ParameterControls (org.jbehave.core.steps.ParameterControls)1 ParameterConverters (org.jbehave.core.steps.ParameterConverters)1 Test (org.junit.Test)1