gherkin v1.4.0 Gherkin

See Gherkin.parse/1 for primary usage.

Summary

Functions

Given a Gherkin.Element.Feature, changes all Gherkin.Elements.ScenarioOutlines into Gherkin.ElementScenario as a flattened list of scenarios

Primary helper function for parsing files or streams through Gherkin. To use simply call this function passing in the full text of the file or a file stream

Changes a Gherkin.Elements.ScenarioOutline into multiple Gherkin.Elements.Scenarios so that they may be executed in the same manner

Functions

flatten(feature)

Given a Gherkin.Element.Feature, changes all Gherkin.Elements.ScenarioOutlines into Gherkin.ElementScenario as a flattened list of scenarios.

parse(string_or_stream)

Primary helper function for parsing files or streams through Gherkin. To use simply call this function passing in the full text of the file or a file stream.

Example:

%Gherkin.Elements.Feature{scenarios: scenarios} = File.read!("test/features/coffee.feature") |> Gherkin.parse()
# Do something with `scenarios`

# Also supports file streams for larger files (must read by lines, bytes not supported)
%Gherkin.Elements.Feature{scenarios: scenarios} = File.stream!("test/features/coffee.feature") |> Gherkin.parse()
parse_file(file_name)
scenarios_for(scenario_outline)

Changes a Gherkin.Elements.ScenarioOutline into multiple Gherkin.Elements.Scenarios so that they may be executed in the same manner.

Given an outline, its easy to run all scenarios:

outline = %Gherkin.Elements.ScenarioOutline{}
Gherkin.scenarios_for(outline) |> Enum.each(&run_scenario/1)