Skip to content

Latest commit

 

History

History
83 lines (70 loc) · 2.87 KB

README.md

File metadata and controls

83 lines (70 loc) · 2.87 KB

JUnit support for JBehave

Maven Central Build Status Coverage Status codebeat badge Codacy Badge

Support library which should help with running jbehave BDD tests.

Integration to java project

Setup in the maven project:

<dependency>
    <groupId>org.jbehavesupport</groupId>
    <artifactId>jbehave-junit-support</artifactId>
</dependency>

JUnit 5

Very simple java class used by the JUnit 5 compatible test engine:

public class BasicStory extends JUnit5Story {

    public BasicStory() {
        EmbedderConfiguration.recommendedConfiguration(configuredEmbedder());
    }

    @Override
    public Configuration configuration() {
        return new MostUsefulConfiguration();
    }

    ...
}

JUnit 4

To use JUnit4 runner please add a dependency for junit or junit-vintage-engine to your project explicitly. Very simple java class with runner implementation:

@RunWith(JUnitRunner.class)
public class BasicStory extends JUnitStory {

    public BasicStory() {
        JUnitRunnerConfiguration.recommendedConfiguration(configuredEmbedder());
    }

    @Override
    public Configuration configuration() {
        return new MostUsefulConfiguration();
    }

    ...
}

Stories can be run in two modes:

  • step
  • story

Reporting level can be chosen by jvm environment variable for step level:

-Djbehave.report.level=STEP

In the IDE reporting is shown: Step level Step level is default reporting level. For story level you should use:

-Djbehave.report.level=STORY

In the IDE reporting is shown: Story level

Compatibility matrix

jbehave-junit-support jbehave
1.0.1 4.0.5
1.2.7 4.1.3
4.3.5 4.3.5
4.6.1 4.6.1
4.8.0 4.8
4.8.3 4.8.3
5.0.0 5.0