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.

The configurable elements of the scenario include:

StepCreator: Represents the strategy for the creation of executable steps from a given scenario definition matching a list of candidate steps. The default implementation is UnmatchedToPendingStepCreator.

ScenarioDefiner: Loads scenarios contained in a story from a given scenario class. The default implementation is ClasspathScenarioDefiner.

ScenarioReporter: Allows the runner to report the state of running scenarios. The default implementation is PrintStreamScenarioReporter.

ErrorStrategy: Allows to define the strategy for error handling. The default value is RETHROW.

KeyWords: Allows to specify the keywords used. The default value is I18nKeyWords.

JBehave provides two useful base implementations that users can extend to override only the elements that differ from default behaviour:

MostUsefulConfiguration: provides default configuration that most user will find appropriate

PropertyBasedConfiguration: overrides default configuration via system properties

Configuring Steps

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

StepPatternBuilder: defaults to PrefixCapturingPatternBuilder.

StepMonitor: defaults to SilentStepMonitor, useful to either debug the step matching or to describe the steps being performed to some output.

ParameterConverters: facade for collecting user-defined ParameterConverters.

KeyWords: defaults to I18nKeyWords.