java 黄瓜.runtime.CucumberException:无法实例化类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35591099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 00:19:59  来源:igfitidea点击:

cucumber.runtime.CucumberException: Failed to instantiate class

javaanttestngcucumber-jvmcucumber-junit

提问by Umang

Here is my cucumber base class.

这是我的黄瓜基类。

@CucumberOptions(plugin = "json:target/cucumber-report.json", features="SFDC_Automation/features/featurefilename.feature", glue="classpath:tests.SFDC.StepDef")
public class InsideSaleTest extends AbstractTestNGCucumberTests {
}

And after running this base class, I am seeing following exception.

在运行这个基类之后,我看到了以下异常。

cucumber.runtime.CucumberException: Failed to instantiate class tests.SFDC.InsideSale.InsideSaleEndToEnd

黄瓜.runtime.CucumberException:无法实例化类tests.SFDC.InsideSale.InsideSaleEndToEnd

===============================================

================================================

InsideSaleEndToEndTesting
Total tests run: 1, Failures: 1, Skips: 0

InsideSaleEndToEndTesting
运行的测试总数:1,失败:1,跳过:0

===============================================

================================================

Can some please help me resolve this issue? thanks a ton!

有人可以帮我解决这个问题吗?万分感谢!

回答by Bhuvanesh Mani

I assume that your class file InsideSaleEndToEndTesting was containing annotations of JUnit and also glue codes/functions. Hence when cucumber tried to create a instance of InsideSaleEndToEndTesting, it had thrown these exceptions.

我假设您的类文件 InsideSaleEndToEndTesting 包含 JUnit 的注释以及粘合代码/函数。因此,当 Cucumber 尝试创建 InsideSaleEndToEndTesting 的实例时,它抛出了这些异常。