BDD stands for Behaviour-Driven Development and you can learn more about BBD from our More on BDD page.
JBehave requires a JDK 1.8 or greater at build and runtime
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.
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 { @org.testng.annotations.Test public void run() throws Throwable { super.run(); } }
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.
Check the dependencies details.
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 { @Test public void run() throws Throwable { super.run(); } }
Note that this is only required for the root class of all your Java hierarchy.
Configure the PendingStepStrategy: in Configuration
new MostUsefulConfiguration().usePendingStepStrategy(new FailingUponPendingStep());
Configure the StoryReporter in Configuration
new MostUsefulConfiguration().useStoryReporter(new SilentSuccessFilter(ConsoleOutput()));
Alternatively, you can use PropertyBasedConfiguration setting system property "org.jbehave.core.configuration.silentsuccess".
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.
Yes, Guice, Needle, PicoContainer and Spring are supported. See dependency injection page for more details.
Yes, both annotated and programmatic configuration is supported. See configuration page for more details.
Yes, at various levels: