public class Steps extends Object implements CandidateSteps
Default implementation of CandidateSteps
which provides the step
candidates that match the steps being run.
To provide your step candidate methods, you can:
Steps
class, in which case the instance is the
extended Steps
class itself ("is-a" relationship)Steps
class implementation.
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:
Modifier and Type | Class and Description |
---|---|
static class |
Steps.DuplicateCandidateFound |
Constructor and Description |
---|
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,
Class<?> type,
InjectableStepsFactory stepsFactory)
Creates Steps with given custom configuration and a steps instance type
containing the candidate step methods.
|
Steps(Configuration configuration,
Object instance)
Creates Steps with given custom configuration and a steps instance
containing the candidate step methods
|
Modifier and Type | Method and Description |
---|---|
Configuration |
configuration()
Returns the configuration
|
Object |
instance() |
List<BeforeOrAfterStep> |
listBeforeOrAfterScenario(ScenarioType type)
Returns the before or after scenario steps
|
List<BeforeOrAfterStep> |
listBeforeOrAfterStories()
Returns the before or after stories steps
|
List<BeforeOrAfterStep> |
listBeforeOrAfterStory(boolean givenStory)
Returns the before or after story steps, based on the given story status
|
List<StepCandidate> |
listCandidates()
Returns the step candidates that can be matched
|
String |
toString() |
Class<?> |
type() |
public Steps()
public Steps(Configuration configuration)
configuration
- the Configurationpublic Steps(Configuration configuration, Object instance)
configuration
- the Configurationinstance
- the steps instancepublic Steps(Configuration configuration, Class<?> type, InjectableStepsFactory stepsFactory)
configuration
- the Configurationtype
- the steps instance typestepsFactory
- the InjectableStepsFactory
public Class<?> type()
public Object instance()
public Configuration configuration()
CandidateSteps
configuration
in interface CandidateSteps
public List<StepCandidate> listCandidates()
CandidateSteps
listCandidates
in interface CandidateSteps
public List<BeforeOrAfterStep> listBeforeOrAfterStories()
CandidateSteps
listBeforeOrAfterStories
in interface CandidateSteps
public List<BeforeOrAfterStep> listBeforeOrAfterStory(boolean givenStory)
CandidateSteps
listBeforeOrAfterStory
in interface CandidateSteps
givenStory
- the boolean flag denoting if it's a given storypublic List<BeforeOrAfterStep> listBeforeOrAfterScenario(ScenarioType type)
CandidateSteps
listBeforeOrAfterScenario
in interface CandidateSteps
type
- the ScenarioTypeCopyright © 2003–2016. All rights reserved.