Search in sources :

Example 16 with StoryReporterBuilder

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

the class SpringSecurityStories method configuration.

@Override
public Configuration configuration() {
    Configuration configuration = new MostUsefulConfiguration();
    configuration.useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(getClass())).withDefaultFormats().withFormats(CONSOLE, TXT, HTML, XML));
    return configuration;
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) Configuration(org.jbehave.core.configuration.Configuration) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration)

Example 17 with StoryReporterBuilder

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

Example 18 with StoryReporterBuilder

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

the class EmbedderBehaviour method shouldNotGenerateViewIfSkipFlagIsSet.

@Test
public void shouldNotGenerateViewIfSkipFlagIsSet() throws Throwable {
    // Given
    PerformableTree performableTree = mock(PerformableTree.class);
    EmbedderControls embedderControls = new EmbedderControls().doSkip(true);
    OutputStream out = new ByteArrayOutputStream();
    EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
    ViewGenerator viewGenerator = mock(ViewGenerator.class);
    Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
    embedder.configuration().useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats());
    embedder.configuration().useViewGenerator(viewGenerator);
    File outputDirectory = new File("target/output");
    List<String> formats = asList("html");
    Properties viewResources = new Properties();
    embedder.generateReportsView(outputDirectory, formats, viewResources);
    // Then
    verify(viewGenerator, never()).generateReportsView(outputDirectory, formats, viewResources);
    assertThat(out.toString(), not(containsString("Generating stories view")));
    assertThat(out.toString(), not(containsString("Stories view generated")));
}
Also used : PrintStream(java.io.PrintStream) StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) ViewGenerator(org.jbehave.core.reporters.ViewGenerator) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) UsingEmbedder(org.jbehave.core.annotations.UsingEmbedder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Matchers.containsString(org.hamcrest.Matchers.containsString) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 19 with StoryReporterBuilder

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

the class UnpackViewResources method viewDirectory.

private File viewDirectory() {
    if (viewDirectory != null) {
        return viewDirectory;
    }
    StoryReporterBuilder storyReporterBuilder = newEmbedder().configuration().storyReporterBuilder();
    String build = project.getBuild().getDirectory();
    String output = storyReporterBuilder.outputDirectory().getName();
    String view = storyReporterBuilder.viewResources().getProperty("viewDirectory");
    return new File(build + "/" + output + "/" + view);
}
Also used : StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) File(java.io.File)

Example 20 with StoryReporterBuilder

use of org.jbehave.core.reporters.StoryReporterBuilder 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

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