io.cucumber.core.gherkin.FeatureParserException: Failed to parse resource at

22.5k Views Asked by At

I am trying to build a framework using io.cucumber but gives me an error which mentions in the title

TestRunner File

package Test_Runner;


import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;



@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        features = "src/test/resources/features",
        plugin = { "pretty","html:target/cucumber-pretty",
                "json:target/cucumber.json" },
        glue = "Test_Runner/Steps",
        dryRun = true)
public class TestRunner {
}

When I am running with an older version of cucumber dependency it's not giving error.

The error shows when I run is as below

io.cucumber.core.gherkin.FeatureParserException: Failed to parse resource at: file:///G:/Testing/Projects/RanajiAgro/src/test/resources/features/Login.feature

    at io.cucumber.core.gherkin.vintage.GherkinVintageFeatureParser.parseGherkin5(GherkinVintageFeatureParser.java:40)
3

There are 3 best solutions below

0
Sandeep  Ambati On

Please check the specified feature file (entire file) for proper gherkin format. Even a blank space between Scenario and : can cause this issue as well

Usual Typo Mistakes causing the error

  1. Scenario(blank Space): and Scenario Outline(blank space):
  2. Instead of Examples, most use Example
  3. |Name||password|| - unwanted || for parameters
0
Jack Vicky On

GO to the problematic gherkin feature file and do the below 'Pretty format' For Intellij press -> Ctrl + Alt + L For Eclipse press -> Ctrl + Shift + F

0
roudlek On

One simple space can cause the problem.

i had :

Feature : my feature

adding the space after Feature caused the problem;

so i did :

Feature: my feature