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

Implementation of CandidateSteps which provides access to the candidate steps that match the story you want to run.

To provide your candidate steps methods, you can either extend the Steps class or pass it any Object instance that it can wrap. In the former case, the instance is the extended Steps class itself. Both "has-a" relationship and "is-a" design models are thus supported.

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.DuplicateCandidateStepFoundException
           
 
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.util.List<CandidateStep> listCandidates()
          Returns the candidate steps that can be matched
 java.util.List<Step> runAfterScenario()
          Returns the steps to run after each scenario
 java.util.List<Step> runAfterStory(boolean givenStory)
          Returns the steps to run after each story, based on the given story status
 java.util.List<Step> runBeforeScenario()
          Returns the steps to run before each scenario
 java.util.List<Step> runBeforeStory(boolean givenStory)
          Returns the steps to run before each story, based on the given story status
 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

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<CandidateStep> listCandidates()
Description copied from interface: CandidateSteps
Returns the candidate steps that can be matched

Specified by:
listCandidates in interface CandidateSteps
Returns:
The list of candidate steps

runBeforeStory

public java.util.List<Step> runBeforeStory(boolean givenStory)
Description copied from interface: CandidateSteps
Returns the steps to run before each story, based on the given story status

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

runAfterStory

public java.util.List<Step> runAfterStory(boolean givenStory)
Description copied from interface: CandidateSteps
Returns the steps to run after each story, based on the given story status

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

runBeforeScenario

public java.util.List<Step> runBeforeScenario()
Description copied from interface: CandidateSteps
Returns the steps to run before each scenario

Specified by:
runBeforeScenario in interface CandidateSteps
Returns:
The list of runnable steps

runAfterScenario

public java.util.List<Step> runAfterScenario()
Description copied from interface: CandidateSteps
Returns the steps to run after each scenario

Specified by:
runAfterScenario in interface CandidateSteps
Returns:
The list of runnable steps

toString

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


Copyright © 2003-2010. All Rights Reserved.