use of org.jbehave.core.reporters.ViewGenerator 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")));
}
use of org.jbehave.core.reporters.ViewGenerator in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldThrowExceptionIfNoScenariosRunForStoriesAndIgnoreFlagIsNotSet.
@Test(expected = RunningStoriesFailed.class)
public void shouldThrowExceptionIfNoScenariosRunForStoriesAndIgnoreFlagIsNotSet() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls();
OutputStream out = new ByteArrayOutputStream();
EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
ViewGenerator viewGenerator = mock(ViewGenerator.class);
Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
embedder.configuration().useViewGenerator(viewGenerator);
File outputDirectory = new File("target/output");
List<String> formats = asList("html");
Properties viewResources = new Properties();
when(viewGenerator.getReportsCount()).thenReturn(new ReportsCount(1, 0, 0, 0, 0, 0, 0, 1));
embedder.generateReportsView(outputDirectory, formats, viewResources);
// Then fail as expected
}
use of org.jbehave.core.reporters.ViewGenerator in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldThrowExceptionIfScenariosFailedAndIgnoreFlagIsNotSet.
@Test(expected = RunningStoriesFailed.class)
public void shouldThrowExceptionIfScenariosFailedAndIgnoreFlagIsNotSet() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls();
OutputStream out = new ByteArrayOutputStream();
EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
ViewGenerator viewGenerator = mock(ViewGenerator.class);
Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
embedder.configuration().useViewGenerator(viewGenerator);
File outputDirectory = new File("target/output");
List<String> formats = asList("html");
Properties viewResources = new Properties();
when(viewGenerator.getReportsCount()).thenReturn(new ReportsCount(1, 0, 1, 2, 1, 1, 1, 1));
embedder.generateReportsView(outputDirectory, formats, viewResources);
// Then fail as expected
}
use of org.jbehave.core.reporters.ViewGenerator in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldNotThrowExceptionIfScenariosFailedAndIgnoreFlagIsSet.
@Test
public void shouldNotThrowExceptionIfScenariosFailedAndIgnoreFlagIsSet() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls().doIgnoreFailureInView(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().useViewGenerator(viewGenerator);
File outputDirectory = new File("target/output");
List<String> formats = asList("html");
Properties viewResources = new Properties();
when(viewGenerator.getReportsCount()).thenReturn(new ReportsCount(1, 0, 1, 2, 1, 0, 1, 1));
embedder.generateReportsView(outputDirectory, formats, viewResources);
// Then
verify(viewGenerator).generateReportsView(outputDirectory, formats, viewResources);
assertThatReportsViewGenerated(out);
}
use of org.jbehave.core.reporters.ViewGenerator in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldFailWhenGeneratingReportsViewWithFailedSteps.
@Test(expected = RunningStoriesFailed.class)
public void shouldFailWhenGeneratingReportsViewWithFailedSteps() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls().doGenerateViewAfterStories(false);
OutputStream out = new ByteArrayOutputStream();
EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
ViewGenerator viewGenerator = mock(ViewGenerator.class);
Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
embedder.configuration().useViewGenerator(viewGenerator);
File outputDirectory = new File("target/output");
List<String> formats = asList("html");
Properties viewResources = new Properties();
when(viewGenerator.getReportsCount()).thenReturn(new ReportsCount(2, 0, 0, 2, 1, 0, 0, 1));
embedder.generateReportsView(outputDirectory, formats, viewResources);
// Then
verify(viewGenerator).generateReportsView(outputDirectory, formats, viewResources);
assertThatReportsViewGenerated(out);
}
Aggregations