use of org.jbehave.core.reporters.PrintStreamStepdocReporter in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldReportNoMatchingStepdocsFoundWhenNoStepsProvided.
@Test
public void shouldReportNoMatchingStepdocsFoundWhenNoStepsProvided() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList(new CandidateSteps[] {}));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a non-defined step");
// Then
String expected = "Step 'Given a non-defined step' is not matched by any pattern\n" + "as no steps instances are provided\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
use of org.jbehave.core.reporters.PrintStreamStepdocReporter in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldFindAndReportMatchingSteps.
@Test
public void shouldFindAndReportMatchingSteps() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a given");
// Then
String expected = "Step 'Given a given' is matched by annotated patterns:\n" + "'Given a given'\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.given()\n" + "from steps instances:\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
use of org.jbehave.core.reporters.PrintStreamStepdocReporter in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldReportNoMatchingStepdocsFoundWithStepProvided.
@Test
public void shouldReportNoMatchingStepdocsFoundWithStepProvided() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportMatchingStepdocs("Given a non-defined step");
// Then
String expected = "Step 'Given a non-defined step' is not matched by any pattern\n" + "from steps instances:\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps\n";
assertThat(dos2unix(out.toString()), equalTo(expected));
}
use of org.jbehave.core.reporters.PrintStreamStepdocReporter in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldReportAllStepdocs.
@Test
public void shouldReportAllStepdocs() {
// Given
Embedder embedder = new Embedder();
embedder.useCandidateSteps(asList((CandidateSteps) new MySteps()));
embedder.configuration().useStepFinder(new StepFinder());
OutputStream out = new ByteArrayOutputStream();
embedder.configuration().useStepdocReporter(new PrintStreamStepdocReporter(new PrintStream(out)));
// When
embedder.reportStepdocs();
// Then
String output = dos2unix(out.toString());
assertThat(output, containsString("'Given a given'\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.given()\n"));
assertThat(output, containsString("'When a when'\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.when()\n"));
assertThat(output, containsString("'Then a then'\n" + "org.jbehave.core.embedder.EmbedderBehaviour$MySteps.then()\n"));
assertThat(output, containsString("from steps instances:\norg.jbehave.core.embedder.EmbedderBehaviour$MySteps\n"));
}
Aggregations