use of org.jbehave.core.steps.StepFinder in project jbehave-core by jbehave.
the class ReportTransformBehaviour method runStories.
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats().withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class)).withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder).useFailureStrategy(new SilentlyAbsorbingFailure()).useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jbehave.core.steps.StepFinder in project jbehave-core by jbehave.
the class ReportTransformBehaviour method runStories.
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats().withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class)).withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder).useFailureStrategy(new SilentlyAbsorbingFailure()).useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jbehave.core.steps.StepFinder 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.steps.StepFinder 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.steps.StepFinder 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));
}
Aggregations