Gherkin.Parser (Cucumber v0.8.0)
View SourceGherkin parser using NimbleParsec.
This module parses Gherkin feature files into Elixir structs, supporting:
- Feature with name, description, and tags
- Background with steps
- Scenarios with steps and tags
- Scenario Outlines with Examples
- Steps with keywords, text, docstrings, and datatables
It implements a subset of the Gherkin language focused on core BDD concepts.
Summary
Functions
Parses a Gherkin feature file from a string into structured data.
Functions
Parses a Gherkin feature file from a string into structured data.
This function takes a string containing Gherkin syntax and parses it into a
structured Gherkin.Feature struct with its associated components.
Parameters
gherkin_string- A string containing Gherkin syntax
Returns
Returns a %Gherkin.Feature{} struct containing:
name- The feature namedescription- The feature descriptiontags- List of feature-level tagsbackground- Background steps (if present)scenarios- List of scenarios
Examples
# Parse a string containing Gherkin syntax
Gherkin.Parser.parse("Feature: Shopping Cart\nScenario: Adding an item")
# Returns %Gherkin.Feature{} struct with parsed data