JBehave is designed to allow textual stories to be written before the implementation, i.e. to let the specification of the behaviour drive the development. For this reason, with steps that do not match any method in the Steps class, which are called pending steps, it does not fail by default. By marking a step as pending, it's simply telling the scenario writer that it's not yet implemented and correspondingly it will not execute any steps that following in the same scenario.
Configuration configuration = new MostUsefulConfiguration() .usePendingStepStrategy(new FailingUponPendingStep());Pending steps are steps that do not match any public Java method in the steps classes. They should not be confused with steps marked as NOT PERFORMED that occur after a step failure.
The @Pending annotation allows steps developers to mark any step method as pending:
This would make the following textual step be marked as pending:
Given a stock of symbol STK and a threshold of 10.0 (PENDING)
The intention of the @Pending annotation is to tell JBehave that the step has yet to be implemented. It is then by conscious choice that the Steps developer should remove the annotation when the step has been implemented.A method annotated with @Pending will always result in a pending step, overriding the matching that would result from the pattern provided in the @Given/@When/@Then annotations.
It may be sometimes useful to run in dry-run mode, checking if any steps are pending but without actually executed any of the steps, as this may take a considerable time. The dry-run mode may be enabled via the Configuration:
Configuration configuration = new MostUsefulConfiguration() .useStepMonitor(new PrintStreamStepMonitor()) // default is SilentStepMonitor() .doDryRun(true); // default is "false" new InstanceStepsFactory(configuration, new MySteps());
We've here configured the steps to use a verbose monitoring, so that the use can see that in dry-run mode the step that is about to be performed will be followed by a "(DRY RUN)" additional tag. When dry-run mode is activated, it will also be shown in the reporters' output.
If you are finding the methods are not being matched and the steps marked as pending, check that: