Writing Text Scenarios

We encourage users to start from writing your scenarios in a non-Java format, e.g. in simple text: and to give a name that is expressive, i.e. status_alert_can_be_activated.scenario. This scenario will map to a Java file StatusAlertCanBeActivated.java in same package.

Writing Java Scenarios

The contract for a user-defined Java scenario is the following:

  1. Must extend an instance of a RunnableScenario, such as JUnitScenario
  2. Must provide a default constructor and a constructor with a ClassLoader parameter, e.g.:
  3. Must inject an instance of CandidateSteps, e.g.:

Configuring Scenarios

JBehave was designed to be highly configurable but to provide default behaviour for the most useful configuration. Configuration is the main interface for configuring all the components of a scenario. JBehave provides two implementations:

Configuring Steps

Steps can also be configured to a high degree via the StepsConfiguration. Among the elements that can be configured are: