Support for 'Examples' in Cucumber specification
See original GitHub issueFeature 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:
- Created 11 years ago
- Comments:12 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OP: You need to use ‘Scenario Outline’ in order to use ‘Examples’.
I think we should just allow
Examples
underScenario
, and makeScenario 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.