Search in sources :

Example 6 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class MapStoriesAsEmbeddables method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Mapping stories as embeddables using embedder " + embedder);
    try {
        embedder.runAsEmbeddables(classNames());
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to map stories as embeddables", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 7 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class MapStoriesAsPaths method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Mapping stories as paths using embedder " + embedder);
    try {
        embedder.mapStoriesAsPaths(storyPaths());
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to map stories as paths", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 8 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class ReportStepdocs method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    Embedder embedder = newEmbedder();
    getLog().info("Reporting stepdocs using embedder " + embedder);
    try {
        embedder.reportStepdocs();
    } catch (RuntimeException e) {
        throw new MojoFailureException("Failed to report stepdocs", e);
    }
}
Also used : MojoFailureException(org.apache.maven.plugin.MojoFailureException) Embedder(org.jbehave.core.embedder.Embedder)

Example 9 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class EmbedderMojoBehaviour method shouldCreateNewEmbedderWithDefaultControls.

@Test
public void shouldCreateNewEmbedderWithDefaultControls() {
    // Given
    AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {

        public void execute() throws MojoExecutionException, MojoFailureException {
        }
    };
    // When
    Embedder embedder = mojo.newEmbedder();
    // Then
    EmbedderControls embedderControls = embedder.embedderControls();
    assertThat(embedderControls.batch(), is(false));
    assertThat(embedderControls.generateViewAfterStories(), is(true));
    assertThat(embedderControls.ignoreFailureInStories(), is(false));
    assertThat(embedderControls.ignoreFailureInView(), is(false));
    assertThat(embedderControls.threads(), is(1));
    assertThat(embedderControls.skip(), is(false));
    assertThat(embedderControls.storyTimeouts(), equalTo("300"));
    assertThat(embedderControls.failOnStoryTimeout(), is(false));
    assertThat(embedderControls.threads(), equalTo(1));
}
Also used : Embedder(org.jbehave.core.embedder.Embedder) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) EmbedderControls(org.jbehave.core.embedder.EmbedderControls) Test(org.junit.Test)

Example 10 with Embedder

use of org.jbehave.core.embedder.Embedder in project jbehave-core by jbehave.

the class EmbedderMojoBehaviour method shouldCreateNewEmbedderWithExecutors.

@Test
public void shouldCreateNewEmbedderWithExecutors() {
    // Given
    AbstractEmbedderMojo mojo = new AbstractEmbedderMojo() {

        public void execute() throws MojoExecutionException, MojoFailureException {
        }
    };
    // When
    mojo.executorsClass = MyExecutors.class.getName();
    Embedder embedder = mojo.newEmbedder();
    // Then
    assertThat(embedder.executorService(), sameInstance(EXECUTOR_SERVICE));
}
Also used : Embedder(org.jbehave.core.embedder.Embedder) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) Test(org.junit.Test)

Aggregations

Embedder (org.jbehave.core.embedder.Embedder)56 Test (org.junit.Test)33 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)25 ConfigurableEmbedder (org.jbehave.core.ConfigurableEmbedder)10 MojoFailureException (org.apache.maven.plugin.MojoFailureException)8 EmbedderControls (org.jbehave.core.embedder.EmbedderControls)7 Configuration (org.jbehave.core.configuration.Configuration)6 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)6 File (java.io.File)5 Properties (java.util.Properties)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)5 CandidateSteps (org.jbehave.core.steps.CandidateSteps)5 StoryPathResolver (org.jbehave.core.io.StoryPathResolver)4 HashSet (java.util.HashSet)3 Artifact (org.apache.maven.artifact.Artifact)3 Build (org.apache.maven.model.Build)3 MavenProject (org.apache.maven.project.MavenProject)3 ArchiverManager (org.codehaus.plexus.archiver.manager.ArchiverManager)3 StoryFinder (org.jbehave.core.io.StoryFinder)3