首页 > 解决方案 > 无法在 selenium-cucumber 框架中实例化类

问题描述

我正在使用黄瓜 3.0.2。下面给出了我的测试运行程序代码。

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

@RunWith(Cucumber.class)
@CucumberOptions(features="features/login.feature",glue= {"stepdefinition"})

public class testrunner {
}

我在 src 中创建了 2 个包(futurerx_testrunner_pkg 和 stepdefinition)。我在 futurerx_testrunner_pkg 包中有 testrunner.java,在 stepdefinition 包中有Basedefinition.java。

但是当我运行代码时,它给出了一个错误“无法在 cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory. java:33) 在 cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:48)"。我是这个黄瓜硒框架的新手,不明白我哪里出错了。在此先感谢。

标签: seleniumcucumber-junit

解决方案


推荐阅读