Exception in thread "main" java.lang.NoSuchMethodError: gherkin.formatter.model.Scenario.getId()Ljava/lang/String;

Exception in thread "main" java.lang.NoSuchMethodError: gherkin.formatter.model.Scenario.getId()Ljava/lang/String;

我正在编写黄瓜代码来自动比较 xml 文件。但是越来越 线程中的异常 "main" java.lang.NoSuchMethodError: gherkin.formatter.model.Scenario.getId()Ljava/lang/String; 当我 运行 特征文件时。我正在使用小黄瓜 2.12.2.

我的功能文件

Feature: File Comparator

Scenario Outline: Comparing XML Files

Given I have <XML1> and <XML2> in <Location1> and <Location2>
When I compare <XML1> to <XML2>
Then Both should be the same
Exmaples:

| XML1| location1 | XML2 | location2|

| XML1.xml| C:/Filepath1| XML2.xml| C:/Filepath2|

我的步骤定义

public class FCStepDefinition {

static Logger log = Logger.getLogger(FCStepDefinition.class);

@Given("^I have ([^\"]*) and ([^\"]*) in ([^\"]*) and ([^\"]*)$")
public static void checkXML1(String xml1, String xml2, String location1, String location2) throws Throwable 
{
    log.info("File name" + xml1 + "and" + xml2 +"from the paths" + location1 + "and" + location2 + "were located");
    System.out.println("File name" + xml1 + "and" + xml2 +"from the paths" + location1 + "and" + location2 + "were located");
}

@When("^I compare ([^\"]*) to ([^\"]*)$")
public static void compareXMLs(String xml1, String location1,String xml2, String location2) throws Exception 
{
    try {
        log.info("Comparing the XML1 to XML2.");
        Assert.assertTrue("\n XML1 is not similar to XML2",XMLComparator.compareXMLs(location1 + xml1, location2 + xml2));
    }

    finally {

    }
}

@Then("^Both should be the same$")
public static void verifyOutput(String expectedSCH, String outputLocation) throws Throwable 
{
    log.info("The Files matches");
}}

我的亚军

package cucumber;

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

@RunWith(Cucumber.class)
@CucumberOptions(

    format = {"pretty", "html:target/html/", "json:target/json/"},
    features = "src/features", 
    strict = true
    )
public class FCRunner {

}

您正在某处引入早期版本的 Gherkin。例如,在 Gherkin 2.11.5 中,该方法在 in 2.12.2 it does.

时尚不存在

检查您的依赖项。