question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for 'Examples' in Cucumber specification

See original GitHub issue

Feature file with ‘Examples’:

Feature: Hello Car

  Scenario: Car can drive
    Given I have a car
    When I add <wheels>
    Then It <can_drive>

  Examples:
  | wheels | can_drive |
  | 1 | false |
  | 2 | false |
  | 3 | false |
  | 4 | true |

Parser throws this error:

gherkin.parser.ParseError: Parse error at Car.feature:8. Found examples when expecting one of: comment, doc_string, row, scenario, scenario_outline, step, tag. (Current getState: step).
    at gherkin.parser.Parser$Machine.event(Parser.java:200)
    at gherkin.parser.Parser.event(Parser.java:152)
    at gherkin.parser.Parser.examples(Parser.java:117)
    at gherkin.lexer.i18n.EN.scan(EN.java:780)
    at gherkin.lexer.I18nLexer.scan(I18nLexer.java:30)
    at gherkin.parser.Parser.parse(Parser.java:57)
    at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:112)
    at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:40)
    at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:98)
    at cucumber.junit.Cucumber.<init>(Cucumber.java:61)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:43)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
mattwynnecommented, Aug 6, 2012

OP: You need to use ‘Scenario Outline’ in order to use ‘Examples’.

5reactions
aslakhellesoycommented, Nov 29, 2016

I think we should just allow Examples under Scenario, and make Scenario Outline a synonym. The first place to change would be in Gherkin’s .berp grammar file. It would also require changes in the ASTs and compiler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gherkin Reference - Cucumber Documentation
Gherkin uses a set of special keywords to give structure and meaning to executable specifications. Each keyword is translated to many spoken languages; ......
Read more >
A Executing specifications with Cucumber - Writing Great ...
Running executable specifications with Cucumber; Following high-level testing techniques; Practicing Test-Driven Development; Writing basic unit tests
Read more >
Cucumber | Hands on Specification by Example - YouTube
In this video, we will do a hands on approach on specification by example and this is how we will be doing from...
Read more >
Cucumber Concepts · CukeTest Help
Behavior Driven Development (BDD) ... BDD emerged from and extends TDD. Instead of writing unit tests from specification why not make the specification...
Read more >
Cucumber Best Practices for Effective BDD Testing
Cucumber is a testing tool that supports behavior-driven development (BDD). ... In BDD, “Given-When-And-Then-But” is the proposed approach for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found