|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbehave.core.steps.Steps
public class Steps
Default implementation of CandidateSteps
which provides access to the
model of candidate steps that match the core you want to run.
To provide your candidate steps method, you can either extend the
Steps
class or pass it a POJO instance that it can wrap.
In the former case, the instance is the Steps
class itself.
You can define the methods that should be run by annotating them with @Given, @When
or @Then, and providing a value for each annotation that matches the step.
The value is interpreted by the StepPatternBuilder
, which by default
interprets the '$' as 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 core model 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(StepsConfiguration configuration)
Creates Steps with given custom configuration |
|
Steps(StepsConfiguration configuration,
java.lang.Object instance)
Creates Steps with given custom configuration wrapping a POJO instance containing the annotated steps methods |
Method Summary | |
---|---|
protected CandidateStep |
createCandidateStep(java.lang.reflect.Method method,
StepType stepType,
java.lang.String stepPatternAsString,
int priority,
StepsConfiguration configuration)
|
StepsConfiguration |
getConfiguration()
Returns the steps configuration |
CandidateStep[] |
getSteps()
Return all the candidate steps that can be performed by the implementing class |
CandidateStep[] |
getSteps(java.lang.Class<?> stepsClass)
Return all the candidate steps that can be performed by the given class |
java.util.List<Step> |
runAfterScenario()
Return all the executable steps to run after each core |
java.util.List<Step> |
runAfterStory(boolean embeddedStory)
Return all the executable steps to run after each story, based on the embedded status |
java.util.List<Step> |
runBeforeScenario()
Return all the executable steps to run before each core |
java.util.List<Step> |
runBeforeStory(boolean embeddedStory)
Return all the executable steps to run before each story, based on the embedded status |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Steps()
public Steps(StepsConfiguration configuration)
configuration
- the StepsConfigurationpublic Steps(StepsConfiguration configuration, java.lang.Object instance)
configuration
- the StepsConfigurationinstance
- the POJO instanceMethod Detail |
---|
public CandidateStep[] getSteps()
CandidateSteps
getSteps
in interface CandidateSteps
public CandidateStep[] getSteps(java.lang.Class<?> stepsClass)
CandidateSteps
getSteps
in interface CandidateSteps
protected CandidateStep createCandidateStep(java.lang.reflect.Method method, StepType stepType, java.lang.String stepPatternAsString, int priority, StepsConfiguration configuration)
public java.util.List<Step> runBeforeStory(boolean embeddedStory)
CandidateSteps
runBeforeStory
in interface CandidateSteps
embeddedStory
- the boolean flag denoting the embedded status
public java.util.List<Step> runAfterStory(boolean embeddedStory)
CandidateSteps
runAfterStory
in interface CandidateSteps
embeddedStory
- the boolean flag denoting the embedded status
public StepsConfiguration getConfiguration()
CandidateSteps
getConfiguration
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
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |