What is BDD?

BDD stands for Behaviour-Driven Development and you can learn more about BBD from our More on BDD page.

What Java version is required by JBehave?

JBehave requires a JDK 1.8 or greater at build and runtime

How do I use JBehave within my development environment?

Stories can be run on command-line (typically for continous-integration) or in any modern Java IDE that supports unit testing frameworks (JUnit supported by default, but any test framework can be easily adopted). Read more on running stories.

Note that stories can also be run via web runner, although the web support is not part of JBehave Core. For more info on web support refer to JBehave Web.

Which testing frameworks does JBehave support?

JBehave comes bundled with out-the-box JUnit support but has no tie-in to JUnit. You can easily configure stories to run with other testing framework, such as TestNG or Spring's Test module (see developing stories for more details).

A quick fix to run with TestNG is simply to annotate the run() method in your root JUnitStory/Stories class with the TestNG @Test annotation:

public class YourStory extends JUnitStory/Stories {

    public void run() throws Throwable {


Note that this is just one way to run stories and if you use other Embedder-based methods you'll need to change the test annotation used correspondingly.

What libraries does JBehave depend on?

Check the dependencies details.

IDE can't seem to recognise the JUnitStory/Stories as a JUnit test

Some IDEs need to be aware of the JBehave source to enable the JUnit plugin for stories, as they can't spot the @Test annotation in a class jar. The link to the core sources is available from the download page.

Alternatively, M2Eclipse users can download the sources automatically.

A simple workaround is to override the JUnitStory/Stories run() method annotated with @Test

public class YourStory extends JUnitStory/Stories {

    public void run() throws Throwable {


Note that this is only required for the root class of all your Java hierarchy.

How do I make my scenarios fail when steps are not matched and are shown as pending?

Configure the PendingStepStrategy: in Configuration

   new MostUsefulConfiguration().usePendingStepStrategy(new FailingUponPendingStep());  

How do I output my story steps just when a story fails?

Configure the StoryReporter in Configuration

   new MostUsefulConfiguration().useStoryReporter(new SilentSuccessFilter(ConsoleOutput()));

Alternatively, you can use PropertyBasedConfiguration setting system property "org.jbehave.core.configuration.silentsuccess".

Can my steps classes be POJOs?

Yes, in fact it's recommended to write steps as POJOs and create instances of CandidateSteps via the InstanceStepsFactory

    Configuration configuration = new MostUsefulConfiguration(); // adapt configuration to your needs
    new InstanceStepsFactory(configuration, new TraderSteps(), new BeforeAndAfterSteps());    

Alternatively, one can extend the Steps class, although not recommended as it provides tie-in with the implementation of the CandidateSteps interface, which is subject to change.

Can I use dependency injection to compose my steps classes?

Yes, Guice, Needle, PicoContainer and Spring are supported. See dependency injection page for more details.

Can I use annotations to configure my stories?

Yes, both annotated and programmatic configuration is supported. See configuration page for more details.

Can I insert comments in the textual scenarios?

Yes, at various levels:

  • In scenario title, which allows free text up the first step starting word of the scenario (e.g. the first Given), provided this is at the beginning of a line. Any keyword not at the beginning of a line, i.e. not preceded by a newline character, will be ignored.
  • Between executable steps, using keyword "!--" (which can be changed via i18n properties).
  • Between example table rows, using separator "|--".