0
I am getting Error parsing feature file (Found scenario when expecting one of: comment, feature, tag)

Solved 1 Answers 888 Views Test Automation
cucumber.runtime.CucumberException: Error parsing feature file *****.feature
    at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:133)
    at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:104)
    at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54)
    at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
    at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:235)
    at cucumber.api.junit.Cucumber.<init>(Cucumber.java:60)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: gherkin.parser.ParseError: Parse error at ******.feature:1. Found scenario when expecting one of: comment, feature, tag. (Current getState: root).
    at gherkin.parser.Parser$Machine.event(Parser.java:207)
    at gherkin.parser.Parser.event(Parser.java:159)
    at gherkin.parser.Parser.scenario(Parser.java:110)
    at gherkin.lexer.En.scan(En.java:762)
    at gherkin.lexer.I18nLexer.scan(I18nLexer.java:36)
    at gherkin.parser.Parser.parse(Parser.java:62)
    at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:131)
    ... 23 more

1 Answer

0
Best answer

You need to start your feature file using feature and not scenario. e.g.

Feature: Hidden links
answered Dec 31, 2015 by Mayur
selected Mar 7 by stbadmin
...