stands for Behaviour-Driven Development and you can learn more about BBD from our More on BDD page.
JBehave uses Java 5 annotations, so any JDK 1.5+ will work.
Scenarios can be run in IDEs, as JUnit tests.
Scenarios can also be run on command line, see running scenarios.
Check the dependencies details.
Some versions of Eclipse need to be aware of the JBehave source to enable the JUnit plugin for scenarios, 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 downlaod the sources automatically.
A workaround is to override the runScenario() method annotated with @Test
public class YourScenario extends JUnitScenario {
@Test
public void runScenario() throws Throwable {
super.runScenario();
}
}
Note that this is only required for the root scenario of all your scenarios.
Similarly to the proposed workaround above, you should be able to run with TestNG by simply annotating the runScenario() method in your root Scenario class with the TestNG @Test annotation.
public class YourScenario extends JUnitScenario {
@org.testng.annotations.Test
public void runScenario() throws Throwable {
super.runScenario();
}
}
Note that we don't tend to use TestNG so this solution as not been tested. If you encounter any issues please let us know.
Configure the PendingErrorStrategy in Configuration
new Configuration(){
public PendingErrorStrategy forPendingSteps() {
return PendingErrorStrategy.FAILING;
}
}
Configure the ScenarioReporter in Configuration
new Configuration(){
public ScenarioReporter forReportingScenarios() {
return new PrintStreamScenarioReporter();
}
}
Alternatively, you can use PropertyBasedConfiguration setting system property "org.jbehave.outputall".