Skip to content

Scenario names cannot start with a keyword #210

@pedantic-git

Description

@pedantic-git

[Please move this to gherkin-ruby if you prefer]

I discovered this by accident, having a scenario called Buttons don't appear, which begins with the keyword But. It looks like all keywords at the start of scenario names cause the parser to fail (on step generation or feature execution). For example:

Feature: Wibble

Scenario: Given a lot of money
  Given I am an example
  When I do example things
  Then I should work
$ ./bin/spinach -g features/wibble.feature
Traceback (most recent call last):
	13: from ./bin/spinach:3:in `<main>'
	12: from ./bin/spinach:3:in `load'
	11: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/bin/spinach:15:in `<top (required)>'
	10: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/lib/spinach/cli.rb:30:in `run'
	 9: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/lib/spinach/runner.rb:61:in `run'
	 8: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/lib/spinach/runner.rb:61:in `map'
	 7: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/lib/spinach/runner.rb:65:in `block in run'
	 6: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/spinach-0.10.1/lib/spinach/parser.rb:39:in `parse'
	 5: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/gherkin-ruby-0.3.2/lib/gherkin_ruby.rb:8:in `parse'
	 4: from gherkin.y:107:in `parse'
	 3: from /usr/src/app/vendor/bundle/ruby/2.5.0/gems/gherkin-ruby-0.3.2/lib/gherkin_ruby/parser/lexer.rb:31:in `scan_str'
	 2: from /usr/local/lib/ruby/2.5.0/racc/parser.rb:259:in `do_parse'
	 1: from /usr/local/lib/ruby/2.5.0/racc/parser.rb:259:in `_racc_do_parse_c'
/usr/local/lib/ruby/2.5.0/racc/parser.rb:528:in `on_error':  (Racc::ParseError)
parse error on value "Given" (GIVEN)

It's easily worked around by renaming the scenario but I thought I'd report it in case it's not a known issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions