org.jbehave.core.steps
Class Steps

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

public class Steps
extends 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:

The "has-a" design model, in which the steps instance is passed in, is strongly recommended over the "is-a" model 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, Class<?> type, InjectableStepsFactory stepsFactory)
          Creates Steps with given custom configuration and a steps instance type containing the candidate step methods.
Steps(Configuration configuration, Object instance)
          Creates Steps with given custom configuration and a steps instance containing the candidate step methods
 
Method Summary
 Configuration configuration()
          Returns the configuration
 Object instance()
           
 List<BeforeOrAfterStep> listBeforeOrAfterScenario(ScenarioType type)
          Returns the before or after scenario steps
 List<BeforeOrAfterStep> listBeforeOrAfterStories()
          Returns the before or after stories steps
 List<BeforeOrAfterStep> listBeforeOrAfterStory(boolean givenStory)
          Returns the before or after story steps, based on the given story status
 List<StepCandidate> listCandidates()
          Returns the step candidates that can be matched
 String toString()
           
 Class<?> type()
           
 
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,
             Object instance)
Creates Steps with given custom configuration and a steps instance containing the candidate step methods

Parameters:
configuration - the Configuration
instance - the steps instance

Steps

public Steps(Configuration configuration,
             Class<?> type,
             InjectableStepsFactory stepsFactory)
Creates Steps with given custom configuration and a steps instance type containing the candidate step methods. The steps instance is created using the steps instance factory provided.

Parameters:
configuration - the Configuration
type - the steps instance type
stepsFactory - the InjectableStepsFactory
Method Detail

type

public Class<?> type()

instance

public 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 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 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 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 List<BeforeOrAfterStep> listBeforeOrAfterScenario(ScenarioType type)
Description copied from interface: CandidateSteps
Returns the before or after scenario steps

Specified by:
listBeforeOrAfterScenario in interface CandidateSteps
Parameters:
type - the ScenarioType
Returns:
The list of before or after steps

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2012. All Rights Reserved.