Stepdocs

The matching of textual steps to Java methods, each representing a candidate step, is a key concept in creating a Domain-Specific Language (DSL). Once the DSL has been defined, we need a way to display the "grammar" of the DSL to enable to scenario writer to exercise that grammar in writing the scenarios.

To this end, JBehave provides the concept of Stepdoc, which represents the documentation on a single candidate step as annotated method in the CandidateSteps instance. This documentation includes:

  • the associated annotation in the method of the CandidateSteps class
  • the pattern to match the candidate step that is configured in the annotation
  • the alias patterns for the candidate step (optional)
  • the method in the CandidateSteps class

To generate the stepdocs for a given list of CandidateSteps instances:

Alternatively, given a RunnableScenario instance:

The RunnableScenario. will use the configured StepdocReporter to report the stepdocs found in the CandidateSteps defined for the scenario.

Stepdocs via Ant task

Remember to include jbehave-ant to your runtime classpath.

Stepdocs via Maven Plugin