Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 运行时无法识别STEPDEF,但当我将鼠标悬停在.feature文件中的步骤上时可以识别它们。为什么?_Java_Maven_Cucumber Jvm - Fatal编程技术网

Java 运行时无法识别STEPDEF,但当我将鼠标悬停在.feature文件中的步骤上时可以识别它们。为什么?

Java 运行时无法识别STEPDEF,但当我将鼠标悬停在.feature文件中的步骤上时可以识别它们。为什么?,java,maven,cucumber-jvm,Java,Maven,Cucumber Jvm,我查看了以下类似问题,这些问题不适用: 也观看了,但没有点击 我正在使用cucumber运行Java 1.8,当我将鼠标悬停在.feature文件中的步骤上时,我可以看到那里的实现,但当我运行测试时,我得到: 您可以使用以下代码段实现缺少的步骤: @Given("^I am on the Login Page$") public void i_am_on_the_Login_Page() throws Throwable { // Write code here that turns

我查看了以下类似问题,这些问题不适用:

也观看了,但没有点击

我正在使用cucumber运行Java 1.8,当我将鼠标悬停在.feature文件中的步骤上时,我可以看到那里的实现,但当我运行测试时,我得到:

您可以使用以下代码段实现缺少的步骤:

@Given("^I am on the Login Page$")
public void i_am_on_the_Login_Page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I enter the non existent email$")
public void i_enter_the_non_existent_email() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I enter the false password$")
public void i_enter_the_false_password() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I click on it$")
public void i_click_on_it() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I still on the page$")
public void i_still_on_the_page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}
我想我可能在项目配置中做了一些错误的事情,但是当我还从

当我用我自己的实现填充skelton项目时,如下所示,我在运行测试时会出现上述相同的错误,但当我将鼠标悬停在.feature文件中的步骤上时,仍然可以看到实现:

@Given("^I am on the Login Page$")
public void i_am_on_the_Login_Page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I enter the non existent email$")
public void i_enter_the_non_existent_email() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I enter the false password$")
public void i_enter_the_false_password() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I click on it$")
public void i_click_on_it() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
}

@Then("^I still on the page$")
public void i_still_on_the_bb() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

} 
 Feature: Login 


  Scenario: Testing with false credentials
    Given I am on the Login Page 
    When I enter the non existent email 
    And I enter the false password 
    And I click on it
    Then I still on the page
.功能文件:

@Given("^I am on the Login Page$")
public void i_am_on_the_Login_Page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I enter the non existent email$")
public void i_enter_the_non_existent_email() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I enter the false password$")
public void i_enter_the_false_password() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

}

@When("^I click on it$")
public void i_click_on_it() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
}

@Then("^I still on the page$")
public void i_still_on_the_bb() throws Throwable {
    // Write code here that turns the phrase above into concrete actions

} 
 Feature: Login 


  Scenario: Testing with false credentials
    Given I am on the Login Page 
    When I enter the non existent email 
    And I enter the false password 
    And I click on it
    Then I still on the page
我正在使用与skelton项目相同的pom.xml文件的Netbeans最新版本

我使用tidy Gherkin将小黄瓜翻译成Java代码

除了Tidy Gherkin之外,还有其他方法可以将小黄瓜翻译成Java特别是Java 8吗??也许这就是问题所在


提前感谢您的帮助

我不在计算机旁,所以我无法检查这一点,但请让您的小黄瓜与您的方法名称完全匹配。

不完全匹配,例如:小黄瓜“我点击它”>>方法名称“我点击它()”,我让Tidy小黄瓜将其从小黄瓜翻译成Java,如果tidy Gherkin不是100%可靠的话,有没有其他方法可以将Gherkin转换为java方法?据我所知,您可以更改从Gherkin获得的方法名称,并且测试应该可以正常运行,所以不能是因为方法名称与Gherkin不匹配,就我所知,您的运行程序文件是什么样子的,你能把错误信息粘贴到这里吗?我试过:@RunWith(Cucumber.class)@CucumberOptions(plugin={“pretty”})公共类RunCukesTest{},也试过:@RunWith(Cucumber.class)@CucumberOptions(plugin={“pretty”},strict=true,monology=true,features=“path/to/.feature/file”)公共类RunCukesTest{}我得到的错误:Running skeleton.RunCukeTest功能:登录场景:使用假凭证测试#skeleton/Bell.Feature:4如果我在登录页面上输入不存在的电子邮件,输入假密码并单击它,然后我仍然在页面上,1个场景(1个未定义)5个步骤(5未定义)每个runner类0.000sas,您在runner类中缺少粘合路径,请添加粘合路径。例如,粘合={“骨架”}