我更新了我的黄瓜版本之后,出现以下异常:
WARNING: You are using deprecated Main class. Please use
io.cucumber.core.api.cli.Main
Exception in thread "main" cucumber.runtime.CucumberException: Failed to
instantiate public
cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader,io.cucum
ber.stepexpression.TypeRegistry)
我的跑步者班:
package hgtest.runner;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@CucumberOptions(plugin = "json:target/cucumber-report.json",
features="classpath:features",
glue="hgtest.stepdefinitions"
)
public abstract class CustomCucumberAbstractTestng extends AbstractTestNGCucumberTests {
public CustomCucumberAbstractTestng() {
}
@Test(
groups = {"cucumber"},
description = "Runs Cucumber Feature",
dataProvider = "features"
)
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}
Pom.xml如下:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>4.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>4.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>4.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>4.1.3</version>
</dependency>
我已经将黄瓜版本从info.cuke更新为io.cucumber。之后,在线程“ main” cucumber.runtime.CucumberException中说异常。没有io.cucumber.core.api.cli.Main。我正在使用intellij Idea
答案 0 :(得分:1)
如@mpkorstanje所述:
要使用的正确类是io.cucumber.core.api.Main
答案 1 :(得分:0)
答案 2 :(得分:0)
我有同样的问题。
我将依赖项放在pom.xml中,并在解决问题的步骤类中实现En接口。
database_connection
答案 3 :(得分:0)
在官方 SmartBear 论坛中,Cucumber Open 的创建者和首席开发者说:
“您可以放心地忽略此警告。这意味着cucumber-eclipse 尚未更新为使用Cucumber 的新包结构。我们对此有一个未解决的问题。如果您对此有强烈的看法,您可以通过以下方式帮助我们向黄瓜日食提交拉取请求。”