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 story 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 Steps instances:

The Embedder will use the StepdocReporter configured in the Configuration to report the stepdocs found.

The Embedder can also find and report stepdocs matching a given textual step. This is very useful when the number of Steps instances and the number of methods grows. The Stepdoc will allow the user to find both the methods and the Steps instances matching the given step.

Stepdocs via Ant task

Remember to include jbehave-ant to your runtime classpath.

Stepdocs via Maven Plugin