Package

gwen

dsl

Permalink

package dsl

Visibility
  1. Public
  2. All

Type Members

  1. case class Background(name: String, description: List[String], steps: List[Step]) extends SpecNode with Product with Serializable

    Permalink

    Captures a gherkin background node.

    Captures a gherkin background node.

    name

    the background name

    description

    optional background description

    steps

    list of background steps

  2. sealed trait EvalStatus extends AnyRef

    Permalink

    Captures the evaluation status of a SpecNode.

  3. case class Failed(nanos: Long, error: Throwable) extends EvalStatus with Product with Serializable

    Permalink

    Defines a failed evaluation status.

    Defines a failed evaluation status.

    nanos

    the duration in nanoseconds

    error

    the error message

  4. case class Feature(tags: Set[Tag], name: String, description: List[String]) extends SpecNode with Product with Serializable

    Permalink

    Captures a gherkin feature node.

    Captures a gherkin feature node.

    tags

    set of tags

    name

    the feature name

    description

    optional description

  5. case class FeatureSpec(feature: Feature, background: Option[Background], scenarios: List[Scenario], featureFile: Option[File] = None, metaSpecs: List[FeatureSpec] = Nil) extends SpecNode with Product with Serializable

    Permalink

    Abstract syntax tree of a successfully parsed feature.

    Abstract syntax tree of a successfully parsed feature. The GherkinParser parses all plain text features into a tree of this type. The interpreter normalises the tree before passing it down to the evaluation engine and lower layers for processing.

    feature

    the feature

    background

    optional background

    scenarios

    list of scenarios

    featureFile

    optional source feature file

    metaSpecs

    optional list of meta specs

  6. trait GherkinParser extends AnyRef

    Permalink

    Uses the Gherkin 3 parser to produce an abstract syntax tree.

    Uses the Gherkin 3 parser to produce an abstract syntax tree. Althouth the entire Gherkin grammar can be parsed, only the following minimal subset is supported by Gwen (we can add support for the remaining subsets in the future if required).

    spec        = feature,
                  [background],
                  {scenario}
    feature     = {tag},
                  "Feature:", name
                  [description]
    background  = "Background:", name
                  [description]
                  {step}
    scenario    = {tag},
                  "Scenario:", name
                  [description]
                  {step}
    tag         = "@", name
    step        = keyword, expression
    keyword     = "Given" | "When" | "Then" | "And" | "But"
    name        = expression
    description   {expression}
    comment     = "#", expression
    expression  = character, {character}

    The parsers defined in this class accept gherkin text as input to produce an abstract syntax tree in the form of a FeatureSpec object. Any input that does not conform to the standard Gherkin grammar results in a parser error. The error contains a the location of the error and a description of the violation.

    The following example shows a valid feature that conforms to the grammar and will parse successfully (whether or not it evaluates is the responsibility of the evaluation layer):

       Feature: Gwen
    
    Background: The butterfly effect
          Given a deterministic nonlinear system
           When a small change is initially applied
           Then a large change will eventually result
    
      Scenario: Evaluation
          Given a software behavior
           When expressed in Gherkin
           Then Gwen can evaluate it
  7. case class Passed(nanos: Long) extends EvalStatus with Product with Serializable

    Permalink

    Defines a passed evaluation status.

    Defines a passed evaluation status.

    nanos

    the duration in nanoseconds

  8. case class Position(line: Int, column: Int) extends Product with Serializable

    Permalink

    Reperesents a position in the source.

  9. case class Scenario(tags: Set[Tag], name: String, description: List[String], background: Option[Background], steps: List[Step], metaFile: Option[File]) extends SpecNode with Product with Serializable

    Permalink

    Captures a gherkin scenario.

    Captures a gherkin scenario.

    tags

    set of tags

    name

    the scenario name

    description

    the optional background description

    background

    optional background

    steps

    list of scenario steps

  10. trait SpecNode extends AnyRef

    Permalink

    Base trait for capturing a feature spec in an abstract syntax tree.

    Base trait for capturing a feature spec in an abstract syntax tree. An spec node is the raw output produced by the GherkinParser.

  11. trait SpecNormaliser extends AnyRef

    Permalink

    Normalises a parsed feature spec in preparation for evaluation.

  12. case class Step(pos: Position, keyword: StepKeyword.Value, expression: String, status: EvalStatus = Pending, attachments: List[(String, File)] = Nil, stepDef: Option[Scenario] = None) extends SpecNode with Product with Serializable

    Permalink

    Captures a gherkin step.

    Captures a gherkin step.

    pos

    the location of the node in the source

    keyword

    keyword identifier (Given, When, Then, etc..)

    expression

    free format step expression line (that is: the text following the step keyword)

    attachments

    file attachments as name-file pairs (default = Nil)

    stepDef

    optional evaluated step def

  13. case class Tag(name: String) extends SpecNode with Product with Serializable

    Permalink

    Captures a gherkin tag.

    Captures a gherkin tag.

    name

    name the tag name

Value Members

  1. object Background extends Serializable

    Permalink
  2. object EvalStatus

    Permalink
  3. object Feature extends Serializable

    Permalink
  4. object FeatureSpec extends Serializable

    Permalink
  5. object Loaded extends EvalStatus with Product with Serializable

    Permalink

    Defines the loaded status.

  6. object Pending extends EvalStatus with Product with Serializable

    Permalink

    Defines the pending status.

  7. object Position extends Serializable

    Permalink
  8. object Scenario extends Serializable

    Permalink
  9. object Skipped extends EvalStatus with Product with Serializable

    Permalink

    Defines the skipped status.

  10. object SpecType extends Enumeration

    Permalink

    Enumeration of supported spec types.

  11. object StatusKeyword extends Enumeration

    Permalink

    Enumeration of supported status keywords.

  12. object Step extends Serializable

    Permalink
  13. object StepKeyword extends Enumeration

    Permalink

    Enumeration of supported step keywords.

    Enumeration of supported step keywords. Every Step expression starts with one of the keywords defined here.

  14. object Tag extends Serializable

    Permalink
  15. object prettyPrint

    Permalink

    Pretty prints a spec node to a string.

    Pretty prints a spec node to a string. This object recursively prints each node to a string and can be invoked as a function. For example, prettyPrint(spec) prints an entire spec, and prettyPrint(step) prints a single step. Included in the output is the evaluation status of node (if not pending).

Ungrouped