Skip to content

Instantly share code, notes, and snippets.

@mattwynne
Forked from ghnatiuk/gist:252883
Created December 10, 2009 17:10
Show Gist options
  • Save mattwynne/253485 to your computer and use it in GitHub Desktop.
Save mattwynne/253485 to your computer and use it in GitHub Desktop.
My view is that we have two domains here - the specification domain, and the execution domain. Gherkin parses the specification model, The compiler translates from the specification model into the execution domain.
The formatters observe the execution, so should operate in that domain. The execution domain model has a mapping to the specification model which created it, so formatters can look up to find out, for example, the feature that a unit comes from, or whether a statement is from a background step or not.
before_features(features) # this allows the formatter to visit the specification model and build whatever representation of that model it wants to (e.g. count scenarios for a progress bar)
before_unit(unit) # unit could be a scenario or example row
before_statement(statement) # statement could be a Before/After hook, a background step or regular step
after_statement(statement, statement_result)
after_unit(unit, unit_result)
after_features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment