org.jbehave.core.steps
Class Steps

java.lang.Object
  extended by org.jbehave.core.steps.Steps
All Implemented Interfaces:
CandidateSteps

public class Steps
extends java.lang.Object
implements CandidateSteps

Default implementation of CandidateSteps which provides the step candidates that match the steps being run.

To provide your step candidate methods, you can either pass it any Object instance that it can wrap ("has-a" relationship) or extend the Steps class ("is-a" relationship), in which case the instance is the extended Steps class itself. The "has-a" design model is strongly recommended as it does not have tie-ins in the Steps class implementation.

You can define the methods that should be run by annotating them with @Given, @When or @Then, and providing as a value for each annotation a pattern matches the textual step. The value is interpreted by the StepPatternParser, which by default is a RegexPrefixCapturingPatternParser that interprets the words starting with '$' as parameters.

For instance, you could define a method as:


Nested Class Summary
static class Steps.DuplicateCandidateFound
           
 
Constructor Summary
Steps()
          Creates Steps with default configuration for a class extending this instance and containing the candidate step methods
Steps(Configuration configuration)
          Creates Steps with given custom configuration for a class extending this instance and containing the candidate step methods
Steps(Configuration configuration, java.lang.Object instance)
          Creates Steps with given custom configuration wrapping an Object instance containing the candidate step methods
 
Method Summary
 Configuration configuration()
          Returns the configuration
 java.lang.Object instance()
           
 java.util.List<BeforeOrAfterStep> listBeforeOrAfterScenario()
          Returns the before or after scenario steps
 java.util.List<BeforeOrAfterStep> listBeforeOrAfterStories()
          Returns the before or after stories steps
 java.util.List<BeforeOrAfterStep> listBeforeOrAfterStory(boolean givenStory)
          Returns the before or after story steps, based on the given story status
 java.util.List<StepCandidate> listCandidates()
          Returns the step candidates that can be matched
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Steps

public Steps()
Creates Steps with default configuration for a class extending this instance and containing the candidate step methods


Steps

public Steps(Configuration configuration)
Creates Steps with given custom configuration for a class extending this instance and containing the candidate step methods

Parameters:
configuration - the Configuration

Steps

public Steps(Configuration configuration,
             java.lang.Object instance)
Creates Steps with given custom configuration wrapping an Object instance containing the candidate step methods

Parameters:
configuration - the Configuration
instance - the Object instance
Method Detail

instance

public java.lang.Object instance()

configuration

public Configuration configuration()
Description copied from interface: CandidateSteps
Returns the configuration

Specified by:
configuration in interface CandidateSteps
Returns:
The Configuration

listCandidates

public java.util.List<StepCandidate> listCandidates()
Description copied from interface: CandidateSteps
Returns the step candidates that can be matched

Specified by:
listCandidates in interface CandidateSteps
Returns:
The list of step candidates

listBeforeOrAfterStories

public java.util.List<BeforeOrAfterStep> listBeforeOrAfterStories()
Description copied from interface: CandidateSteps
Returns the before or after stories steps

Specified by:
listBeforeOrAfterStories in interface CandidateSteps
Returns:
The list of before or after steps

listBeforeOrAfterStory

public java.util.List<BeforeOrAfterStep> listBeforeOrAfterStory(boolean givenStory)
Description copied from interface: CandidateSteps
Returns the before or after story steps, based on the given story status

Specified by:
listBeforeOrAfterStory in interface CandidateSteps
Parameters:
givenStory - the boolean flag denoting if it's a given story
Returns:
The list of before or after steps

listBeforeOrAfterScenario

public java.util.List<BeforeOrAfterStep> listBeforeOrAfterScenario()
Description copied from interface: CandidateSteps
Returns the before or after scenario steps

Specified by:
listBeforeOrAfterScenario in interface CandidateSteps
Returns:
The list of before or after steps

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2010. All Rights Reserved.