Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse issues when trying to use "Examples" section in Cucumber feature

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)

like image 870
Craig Flannagan Avatar asked Aug 05 '10 03:08

Craig Flannagan


People also ask

How do you ignore a specific sample in cucumber?

Put a hash symbol before this example. Cucumber code is a ruby code. AFAIK, one can not skip examples, but it's possible to effectively skip scenarios. So, split the code above into two scenarios and conditionally skip the latter.

What is the feature file in cucumber?

A Feature File is an entry point to the Cucumber tests. This is a file where you will describe your tests in Descriptive language (Like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents.


1 Answers

Replace

Scenario: 

with

Scenario Outline: 
like image 147
AlistairH Avatar answered Sep 18 '22 23:09

AlistairH