|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbehave.scenario.steps.Steps
public class Steps
Extend this class to provide the definition of steps that match the scenario you want to run.
You can define the methods that should be run when each step is performed by annotating them with @Given, @When or @Then, and providing a value for each annotation that matches the step. By default, the match is performed using a '$' prefix to pick up parameters.
For instance, you could define a method as:
<code lang="java"> @When("I log in as $username with password: $password") <br/> public void logIn(String username, String password) { //... } </code>and this would match the step:
When I log in as Liz with password: Pa55word
When the step is perfomed, the parameters in the scenario definition will be passed to the class, so in this case the effect will be
mySteps.logIn("Liz", "Pa55word");
StepsConfiguration can be used to provide customization to the defaults configuration elements, eg custom parameters converters.
Nested Class Summary | |
---|---|
static class |
Steps.DuplicateCandidateStepFoundException
|
class |
Steps.SilentStepResult
|
Constructor Summary | |
---|---|
Steps()
Creates Steps with default configuration |
|
Steps(ParameterConverters converters)
Creates Steps with all default dependencies except for custom parameter converters. |
|
Steps(StepsConfiguration configuration)
Creates Steps with all custom dependencies |
|
Steps(java.lang.String... startingWords)
Creates Steps with all default configuration except for custom starting keywords |
Method Summary | |
---|---|
CandidateStep[] |
getSteps()
Return all the steps that can be performed by the implementing class |
CandidateStep[] |
getSteps(java.lang.Class<?> stepsClass)
Return all the steps that can be performed by the given class |
java.util.List<Step> |
runAfterScenario()
Return all steps to run after scenario |
java.util.List<Step> |
runBeforeScenario()
Return all steps to run before scenario |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Steps()
public Steps(java.lang.String... startingWords)
startingWords
- the words with which we expect steps in the scenarios to startpublic Steps(ParameterConverters converters)
converters
- a set of converters which can change strings into other
objects to pass into executable stepspublic Steps(StepsConfiguration configuration)
configuration
- the StepsConfigurationMethod Detail |
---|
public CandidateStep[] getSteps()
CandidateSteps
getSteps
in interface CandidateSteps
public CandidateStep[] getSteps(java.lang.Class<?> stepsClass)
CandidateSteps
getSteps
in interface CandidateSteps
public java.util.List<Step> runBeforeScenario()
CandidateSteps
runBeforeScenario
in interface CandidateSteps
public java.util.List<Step> runAfterScenario()
CandidateSteps
runAfterScenario
in interface CandidateSteps
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |