29

No luck in googling on this error message

features/manage_hand_evaluator.feature: Parse error at features/manage_hand_evaluator.feature:21. Found examples when expecting one of: comment, py_string, row, scenario, scenario_outline, step, tag. (Current state: step). (Gherkin::Parser::ParseError)

Here's the setup I have for Examples section (there are no other Scenarios at this time, just this one after the "Feature:" section)

...

Scenario: Evaluating for current straights
  Given I am a player with <hand>
  When the board is <board>
  Then the current possible straights should be <possibles>

  Examples:
    | board | hand |    possibles                  | 
    | A23   | 45   | A2345                         | 
    | 3456  | 23   | A2345,23456,34567,45678       | 
    | 789T  | A2   | 56789,6789T,789TJ,89TJQ       | 
    | 45678 | 23   | 23456,34567,45678,56789,6789T | 

I also have step definitions set up already for those "Given, When, Then" lines (and tests passes fine when I replace , , with some text and comment out the "Examples" section). So it seems step definitions are set up properly, just that there is some kind of parsing issue with the contents I have in .feature file and I cannot figure out what I am doing wrong.

Relevant gems installed: Gherkin (2.1.5) (tried 2.2.0 but it breaks with my version of Cucumber) Cucumber (0.8.5) Cucumber-Rails (0.3.2) Rails (2.3.8)

Craig Flannagan
  • 579
  • 1
  • 7
  • 16

2 Answers2

73

Replace

Scenario:

with

Scenario Outline:
Andrei Botalov
  • 19,298
  • 8
  • 82
  • 117
AlistairH
  • 2,879
  • 1
  • 18
  • 19
  • Voted this up now that I have sufficient privileges – Craig Flannagan Nov 19 '10 at 01:32
  • 2
    This worked for me too however as a note to others the reason mine was failing was slightly different. Although I had "Scenario Outline:" there were two spaces rather than just one between 'Scenario' and 'Outline' which was causing the same parse error. Making it one space fixed it – Peter Nixey Jan 12 '11 at 18:37
  • In my case I had a space between Outline and the colon! Thanks to your comment I spotted it; after some time. – TimP Oct 18 '13 at 15:10
1

When you have tests that extends to having examples, you should always use Scenario Outline. Scenario is for those kind of tests with not more than one data to be inputted to test.

Emjey
  • 1,802
  • 1
  • 12
  • 30