Gherkin.Pickle (Cucumber v1.0.0)

View Source

A pickle: one concrete, runnable scenario compiled from a feature's AST.

Pickles are the unit of execution in Cucumber — plain scenarios compile to one pickle each, scenario outlines to one pickle per examples row (with placeholders substituted), and scenarios inside rules inherit the rule's background steps and tags. This mirrors the Cucumber Messages pickle shape while also carrying the provenance the test compiler needs (original names, rule and examples-row origin, tag precedence order).

Fields mirroring the message:

  • id - deterministic sequential id, unique within a compilation
  • uri - the feature file path
  • name - scenario name with outline placeholders substituted
  • language - always "en" (the parser supports English keywords)
  • line - source line of the scenario (or examples row for outlines)
  • ast_node_ids - the AST ids this pickle derives from: [scenario_id], or [outline_id, row_id] for an outline row
  • tags - all tags in effect (feature, rule, outline, examples, scenario), as %{name: "tag", ast_node_id: id} maps
  • steps - Gherkin.PickleStep structs, background steps first

Provenance for test generation (not part of the message):

  • scenario_name/scenario_line - the defining scenario or outline, unsubstituted (test names and failure output use these)
  • rule_name - the enclosing rule's name, or nil
  • examples_name/row_index - the examples block and 1-based row for outline pickles, or nil
  • own_tags - the scenario's own tags merged with inherited rule / outline / examples tags, most specific first (retry-tag precedence)

Summary

Types

t()

@type t() :: %Gherkin.Pickle{
  ast_node_ids: [String.t()],
  examples_name: String.t() | nil,
  id: String.t(),
  language: String.t(),
  line: non_neg_integer() | nil,
  name: String.t(),
  own_tags: [String.t()],
  row_index: pos_integer() | nil,
  rule_name: String.t() | nil,
  scenario_line: non_neg_integer() | nil,
  scenario_name: String.t(),
  steps: [Gherkin.PickleStep.t()],
  tags: [%{name: String.t(), ast_node_id: String.t()}],
  uri: String.t() | nil
}