Search in sources :

Example 1 with CrossReference

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

the class CoreEmbedder method configuration.

@Override
public Configuration configuration() {
    Class<? extends CoreEmbedder> embedderClass = this.getClass();
    TableTransformers tableTransformers = new TableTransformers();
    LoadFromClasspath resourceLoader = new LoadFromClasspath(embedderClass.getClassLoader());
    return new MostUsefulConfiguration().useStoryLoader(resourceLoader).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass)).withDefaultFormats().withFormats(CONSOLE, TXT, HTML, XML).withCrossReference(new CrossReference())).useTableTransformers(tableTransformers).useParameterConverters(new ParameterConverters(resourceLoader, tableTransformers).addConverters(// use custom date pattern
    new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))).useStepPatternParser(new RegexPrefixCapturingPatternParser(// use '%' instead of '$' to identify parameters
    "%")).useStepMonitor(new SilentStepMonitor());
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) RegexPrefixCapturingPatternParser(org.jbehave.core.parsers.RegexPrefixCapturingPatternParser) DateConverter(org.jbehave.core.steps.ParameterConverters.DateConverter) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) SilentStepMonitor(org.jbehave.core.steps.SilentStepMonitor) ParameterConverters(org.jbehave.core.steps.ParameterConverters) CrossReference(org.jbehave.core.reporters.CrossReference) SimpleDateFormat(java.text.SimpleDateFormat) TableTransformers(org.jbehave.core.model.TableTransformers)

Example 2 with CrossReference

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

the class EmbedderBehaviour method shouldGenerateCrossReferenceWhenAvailable.

@Test
public void shouldGenerateCrossReferenceWhenAvailable() {
    Embedder embedder = new Embedder();
    embedder.useConfiguration(new MostUsefulConfiguration().useStoryReporterBuilder(new StoryReporterBuilder().withCrossReference(new CrossReference())));
    // When
    embedder.generateCrossReference();
    // Then
    assertXrefExists(embedder.configuration().storyReporterBuilder(), "json");
    assertXrefExists(embedder.configuration().storyReporterBuilder(), "xml");
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) UsingEmbedder(org.jbehave.core.annotations.UsingEmbedder) CrossReference(org.jbehave.core.reporters.CrossReference) Test(org.junit.Test)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)2 CrossReference (org.jbehave.core.reporters.CrossReference)2 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)2 SimpleDateFormat (java.text.SimpleDateFormat)1 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)1 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)1 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)1 TableTransformers (org.jbehave.core.model.TableTransformers)1 RegexPrefixCapturingPatternParser (org.jbehave.core.parsers.RegexPrefixCapturingPatternParser)1 ParameterConverters (org.jbehave.core.steps.ParameterConverters)1 DateConverter (org.jbehave.core.steps.ParameterConverters.DateConverter)1 SilentStepMonitor (org.jbehave.core.steps.SilentStepMonitor)1 Test (org.junit.Test)1