Java-Cucumber:功能文件未调用步骤定义文件
问题描述:
Java-Cucumber:功能文件未调用步骤定义文件,我正在尝试使用Intellij Idea工具。用CTRL按钮点击功能文件步骤(给定和然后)时,它将重定向到我的步骤定义文件,但在运行时会抛出错误。Java-Cucumber:功能文件未调用步骤定义文件
连接到目标VM,地址: '127.0.0.1:64966',运输: '插座'
Undefined step: Given I am logged in to Intersect HE as user type "administrator"
Undefined step: Then I verify I have access the Intersect Help page
1 Scenarios (1 undefined)
2 Steps (2 undefined)
0m0.000s
You can implement missing steps with the snippets below:
Given("^I am logged in to Intersect HE as user type \"([^\"]*)\"$", (String arg1) -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Then("^I verify I have access the Intersect Help page$",() -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});Disconnected from the target VM, address: '127.0.0.1:64966', transport: 'socket'
enter code here
Process finished with exit code 0
加胶之后,它抛出其他错误“异常线程 “main” cucumber.runtime .CucumberException:无法实例化类stepDefinitions.LoginPageStepDefs“。
stepDefinitions文件被正确添加,不知道为什么我得到这个错误。
答
您有类路径问题。您需要分享更多的设置才能为您提供帮助。
或者你可以让生活更轻松,并从一些有用的东西开始。克隆由黄瓜团队提供的started project。然后转换它来解决你真正想解决的问题。您目前由Gall's law描述的情况:
一个复杂的系统,该系统的工作原理是总是发现已经从工作了 简单的系统演变。从零开始设计的复杂系统永远不会工作,无法修补以使其正常工作。您必须通过一个简单的系统重新开始 。
你可以分享你的TestRunner的代码,你在里面提到的胶水?(如果可能的话您共享文件夹树视图) – Akarsh
你将如何执行功能的文件是否使用的TestRunner或者直接在运行功能文件? – Akarsh
@akarsh:我提到过胶水,我试图直接运行功能文件。 –