CucumberGherkin (CucumberGherkinHotfix v16.0.2)
CucumberGherkin
allows you to parse Gherkin files to pickles (or tokens). These pickles can be used in a cucumber implementation.
The CucumberMessages library is used in almost every step of building the pickles and envelopes.
Testdata is used from the Cucumber repository.
Link to this section Summary
Functions
Parse a single feature file and return a list of envelopes. You can provide the following opts in a list
Returns a list of envelopes. See parse_path/2
for more information.
Rely on CucumberMessages printer to print the envelopes to the specified format. Currently only :ndjson
is supported.
Tokenizes a feature file. Normally you should not need this.
Link to this section Functions
parse_path(path, opts)
Parse a single feature file and return a list of envelopes. You can provide the following opts in a list:
- :no_source
- :no_ast
- :no_pickles
Examples
iex> CucumberGherkin.parse_path("testdata/good/background.feature", [:no_ast, :no_pickles])
[
%CucumberMessages.Envelope{
__uf__: [],
message: {:source,
%CucumberMessages.Source{
# ...
}}
}
]
parse_paths(paths, opts)
Returns a list of envelopes. See parse_path/2
for more information.
print_messages(envelopes, type)
Rely on CucumberMessages printer to print the envelopes to the specified format. Currently only :ndjson
is supported.
It is likely that Elixir projects won't directly use this as they can use the unformatted protobuf message version in Cucumber as well.
Examples
iex> CucumberGherkin.parse_path("testdata/good/background.feature", []) |> CucumberGherkin.print_messages(:ndjson) |> IO.puts
{"source":{"data": .......... }}
{"gherkinDocument":{"feature": ........... }}
{"pickle":{ .......... }}
{"pickle":{ .......... }}
tokenize(feature_file)
Tokenizes a feature file. Normally you should not need this.