This repository has been archived by the owner on May 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Listener API
aslakhellesoy edited this page Sep 13, 2010
·
9 revisions
Gherkin tokenizes its input and sends the results to a listener object. So to use Gherkin, you’ll need an object which responds to the calls in this listener interface. To implement a listener, you’ll need an object which responds to the method signatures below.
All keywords are the I18N names for the event (“Feature” for English, “Egenskap” for Norwegian, etc).
feature(keyword, content, line_number)
background(keyword, content, line_number)
scenario(keyword, content, line_number)
scenario_outline(keyword, content, line_number)
examples(keyword, content, line_number)
step(keyword, content, line_number)
comment(content, line_number)
tag(tag_name, line_number)
table(content_array, line_number)
py_string(offset, content, line_number)
ParsingError will be raised if Gherkin cannot continue parsing input.
SyntaxError will be raised if the text to scan is well formed, but syntactically incorrect:
Gherkin::Feature.new('it', Listener.new) raises FeatureSyntaxError on error
Gherkin::Feature.new('en', AstBuilder.new, :raise_on_error => false) sends #syntax_error message to listener