A Gherkin file parser written in Elixir. Parses .feature
files and translates them to native Elixir terms for processing.
Extracted from https://github.com/meadsteve/white-bread
The package can be installed as:
- Add
gherkin
to your list of dependencies inmix.exs
:
def deps do
[{:gherkin, "~> 1.0"}]
end
- Ensure
gherkin
is started before your application:
def application do
[applications: [:gherkin]]
end
%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()