org.jbehave.core.embedder
Class StoryRunner

java.lang.Object
  extended by org.jbehave.core.embedder.StoryRunner

public class StoryRunner
extends Object

Runs a Story, given a Configuration and a list of CandidateSteps, describing the results to the StoryReporter.

Author:
Elizabeth Keogh, Mauro Talevi, Paul Hammant

Nested Class Summary
static interface StoryRunner.State
           
 
Constructor Summary
StoryRunner()
           
 
Method Summary
 void cancelStory(Story story, StoryDuration storyDuration)
          Cancels story execution following a timeout
 boolean failed(StoryRunner.State state)
           
 Throwable failure(StoryRunner.State state)
           
 void run(Configuration configuration, InjectableStepsFactory stepsFactory, Story story, MetaFilter filter, StoryRunner.State beforeStories)
          Runs a Story with the given steps factory, applying the given meta filter, and staring from given state.
 void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story)
          Runs a Story with the given configuration and steps.
 void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story, MetaFilter filter)
          Runs a Story with the given configuration and steps, applying the given meta filter.
 void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story, MetaFilter filter, StoryRunner.State beforeStories)
          Runs a Story with the given configuration and steps, applying the given meta filter, and staring from given state.
 StoryRunner.State runBeforeOrAfterStories(Configuration configuration, List<CandidateSteps> candidateSteps, StepCollector.Stage stage)
          Run steps before or after a collection of stories.
 Story storyOfPath(Configuration configuration, String storyPath)
          Returns the parsed story from the given path
 Story storyOfText(Configuration configuration, String storyAsText, String storyId)
          Returns the parsed story from the given text
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoryRunner

public StoryRunner()
Method Detail

runBeforeOrAfterStories

public StoryRunner.State runBeforeOrAfterStories(Configuration configuration,
                                                 List<CandidateSteps> candidateSteps,
                                                 StepCollector.Stage stage)
Run steps before or after a collection of stories. Steps are execute only once per collection of stories.

Parameters:
configuration - the Configuration used to find the steps to run
candidateSteps - the List of CandidateSteps containing the candidate steps methods
stage - the Stage
Returns:
The State after running the steps

run

public void run(Configuration configuration,
                List<CandidateSteps> candidateSteps,
                Story story)
         throws Throwable
Runs a Story with the given configuration and steps.

Parameters:
configuration - the Configuration used to run story
candidateSteps - the List of CandidateSteps containing the candidate steps methods
story - the Story to run
Throws:
Throwable - if failures occurred and FailureStrategy dictates it to be re-thrown.

run

public void run(Configuration configuration,
                List<CandidateSteps> candidateSteps,
                Story story,
                MetaFilter filter)
         throws Throwable
Runs a Story with the given configuration and steps, applying the given meta filter.

Parameters:
configuration - the Configuration used to run story
candidateSteps - the List of CandidateSteps containing the candidate steps methods
story - the Story to run
filter - the Filter to apply to the story Meta
Throws:
Throwable - if failures occurred and FailureStrategy dictates it to be re-thrown.

run

public void run(Configuration configuration,
                List<CandidateSteps> candidateSteps,
                Story story,
                MetaFilter filter,
                StoryRunner.State beforeStories)
         throws Throwable
Runs a Story with the given configuration and steps, applying the given meta filter, and staring from given state.

Parameters:
configuration - the Configuration used to run story
candidateSteps - the List of CandidateSteps containing the candidate steps methods
story - the Story to run
filter - the Filter to apply to the story Meta
beforeStories - the State before running any of the stories, if not null
Throws:
Throwable - if failures occurred and FailureStrategy dictates it to be re-thrown.

run

public void run(Configuration configuration,
                InjectableStepsFactory stepsFactory,
                Story story,
                MetaFilter filter,
                StoryRunner.State beforeStories)
         throws Throwable
Runs a Story with the given steps factory, applying the given meta filter, and staring from given state.

Parameters:
configuration - the Configuration used to run story
stepsFactory - the InjectableStepsFactory used to created the candidate steps methods
story - the Story to run
filter - the Filter to apply to the story Meta
beforeStories - the State before running any of the stories, if not null
Throws:
Throwable - if failures occurred and FailureStrategy dictates it to be re-thrown.

storyOfPath

public Story storyOfPath(Configuration configuration,
                         String storyPath)
Returns the parsed story from the given path

Parameters:
configuration - the Configuration used to run story
storyPath - the story path
Returns:
The parsed Story

storyOfText

public Story storyOfText(Configuration configuration,
                         String storyAsText,
                         String storyId)
Returns the parsed story from the given text

Parameters:
configuration - the Configuration used to run story
storyAsText - the story text
storyId - the story Id, which will be returned as story path
Returns:
The parsed Story

cancelStory

public void cancelStory(Story story,
                        StoryDuration storyDuration)
Cancels story execution following a timeout

Parameters:
story - the Story that was timed out
storyDuration - the StoryDuration

toString

public String toString()
Overrides:
toString in class Object

failed

public boolean failed(StoryRunner.State state)

failure

public Throwable failure(StoryRunner.State state)


Copyright © 2003-2012. All Rights Reserved.