org.jbehave.scenario
Class AbstractScenario
java.lang.Object
org.jbehave.scenario.AbstractScenario
- All Implemented Interfaces:
- RunnableScenario
- Direct Known Subclasses:
- JUnitScenario.JUnitScenarioDelegate
public abstract class AbstractScenario
- extends java.lang.Object
- implements RunnableScenario
Abstract implementation of Scenario which is primarily intended as a base
class for delegate implementations of Scenarios. As such, it has no explicit
supports for any test framework, ie it requires the runScenario
method to be invoked directly, and the class of the scenario being run needs
to be provided explicitly.
Typically, users will find it easier to extend decorator scenarios, such as
JUnitScenario
which also provide support for test frameworks and also
provide the scenario class as the one being implemented by the user.
Whichever Scenario class one chooses to extends, the steps for running a
scenario are the same:
- Extend the chosen scenario class and name it after your scenario, eg
"ICanLogin.java" (note that there is no obligation to have the name of the
class end in "Scenario" although you may choose to).
- The scenario class should be in a matching text file in the same place,
eg "i_can_login" (this uses the default name resolution, although the it can
be configured via the
ScenarioNameResolver
).
- Write some steps in your text scenario, starting each new step with
Given, When, Then or And. The keywords can be configured via the
KeyWords
class, eg they can be translated/localized to other
languages.
- Then move on to extending the Steps class and providing matching methods
for the steps defined in the text scenario.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractScenario
public AbstractScenario(java.lang.Class<? extends RunnableScenario> scenarioClass,
CandidateSteps... candidateSteps)
AbstractScenario
public AbstractScenario(java.lang.Class<? extends RunnableScenario> scenarioClass,
Configuration configuration,
CandidateSteps... candidateSteps)
AbstractScenario
public AbstractScenario(java.lang.Class<? extends RunnableScenario> scenarioClass,
ScenarioRunner scenarioRunner,
Configuration configuration,
CandidateSteps... candidateSteps)
runScenario
public void runScenario()
throws java.lang.Throwable
- Specified by:
runScenario
in interface RunnableScenario
- Throws:
java.lang.Throwable
addSteps
public void addSteps(CandidateSteps... steps)
- Specified by:
addSteps
in interface RunnableScenario
getSteps
public java.util.List<CandidateSteps> getSteps()
- Specified by:
getSteps
in interface RunnableScenario
generateStepdoc
public void generateStepdoc()
- Specified by:
generateStepdoc
in interface RunnableScenario
Copyright © 2003-2009. All Rights Reserved.