0

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)
ddjadav
  • 71
  • 1
  • 3
  • 10
  • it's solved. I added the wrong dependency just change io.cucumber » cucumber-gherkin instead of io.cucumber » gherkin – ddjadav Jun 08 '20 at 12:31
  • You should remove that dependency. It's transitive so your tooling should download it automatically. Assuming you don't download them by hand. – M.P. Korstanje Jun 08 '20 at 20:35
  • 2
    The error is telling you it cannot parse the **feature** file. Can you [edit] your question to include Login.feature? – Greg Burghardt Jun 09 '20 at 12:21

3 Answers3

3

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

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

Jack Vicky
  • 81
  • 1
  • 5
0

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

roudlek
  • 160
  • 9