use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class EmbedderMojoBehaviour method shouldCreateNewEmbedderWithSystemProperties.
@Test
public void shouldCreateNewEmbedderWithSystemProperties() {
// Given
AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {
public void execute() throws MojoExecutionException, MojoFailureException {
}
};
// When
Properties systemProperties = new Properties();
systemProperties.setProperty("one", "1");
systemProperties.setProperty("two", "2");
mojo.systemProperties = systemProperties;
Embedder embedder = mojo.newEmbedder();
// Then
assertThat(embedder.systemProperties(), equalTo(systemProperties));
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class EmbedderMojoBehaviour method shouldCreateNewEmbedderWithMetaFilters.
@Test
public void shouldCreateNewEmbedderWithMetaFilters() {
// Given
AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {
public void execute() throws MojoExecutionException, MojoFailureException {
}
};
// When
mojo.metaFilters = new String[] { "filter1", "filter2" };
Embedder embedder = mojo.newEmbedder();
// Then
assertThat(embedder.metaFilters(), equalTo(asList("filter1", "filter2")));
}
use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.
the class EmbedderMojoBehaviour method shouldCreateNewEmbedderIgnoringNullMetaFilters.
@Test
public void shouldCreateNewEmbedderIgnoringNullMetaFilters() {
// Given
AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {
public void execute() throws MojoExecutionException, MojoFailureException {
}
};
// When
mojo.metaFilters = new String[] { "filter1", null };
Embedder embedder = mojo.newEmbedder();
// Then
assertThat(embedder.metaFilters(), equalTo(asList("filter1")));
}
use of org.jbehave.core.embedder.Embedder 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.embedder.Embedder in project jbehave-core by jbehave.
the class AnnotatedPathRunner method run.
@Override
public void run(RunNotifier notifier) {
Embedder embedder = annotationBuilder.buildEmbedder();
NotifierEmbedderMonitor notifierEmbedderMonitor = new NotifierEmbedderMonitor(embedder.embedderMonitor(), notifier);
embedder.useEmbedderMonitor(notifierEmbedderMonitor);
try {
embedder.runStoriesAsPaths(paths);
} finally {
notifierEmbedderMonitor.storyFinished();
}
}
Aggregations