cucumber.runtime
Interface StepDefinition


public interface StepDefinition


Method Summary
 void execute(gherkin.I18n i18n, Object[] args)
          Invokes the step definition.
 String getLocation(boolean detail)
          The source line where the step definition is defined.
 Integer getParameterCount()
          How many declared parameters this stepdefinition has.
 ParameterType getParameterType(int n, Type argumentType)
          The parameter type at index n.
 String getPattern()
           
 boolean isDefinedAt(StackTraceElement stackTraceElement)
          Return true if this matches the location.
 List<gherkin.formatter.Argument> matchedArguments(gherkin.formatter.model.Step step)
          Returns a list of arguments.
 

Method Detail

matchedArguments

List<gherkin.formatter.Argument> matchedArguments(gherkin.formatter.model.Step step)
Returns a list of arguments. Return null if the step definition doesn't match at all. Return an empty List if it matches with 0 arguments and bigger sizes if it matches several.


getLocation

String getLocation(boolean detail)
The source line where the step definition is defined. Example: foo/bar/Zap.brainfuck:42

Parameters:
detail - true if extra detailed location information should be included.

getParameterCount

Integer getParameterCount()
How many declared parameters this stepdefinition has. Returns null if unknown.


getParameterType

ParameterType getParameterType(int n,
                               Type argumentType)
                               throws IndexOutOfBoundsException
The parameter type at index n. A hint about the raw parameter type is passed to make it easier for the implementation to make a guess based on runtime information. Statically typed languages will typically ignore the argumentType while dynamically typed ones will use it to infer a "good type". It's also ok to return null.

Throws:
IndexOutOfBoundsException

execute

void execute(gherkin.I18n i18n,
             Object[] args)
             throws Throwable
Invokes the step definition. The method should raise a Throwable if the invocation fails, which will cause the step to fail.

Throws:
Throwable

isDefinedAt

boolean isDefinedAt(StackTraceElement stackTraceElement)
Return true if this matches the location. This is used to filter stack traces.


getPattern

String getPattern()
Returns:
the pattern associated with this instance. Used for error reporting only.


Copyright © 2012. All Rights Reserved.