我在Eclipse的黄瓜特征文件中得到了那些黄色,它表示步骤“ XXX”没有匹配的粘合代码。我已经有了stepDefinitions,如何摆脱警告消息。有关更多说明,请参见图片Project Structure和Feature File。
黄瓜依赖性
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.5.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>4.5.4</version>
</dependency>
我的PageLoginStep类
package steps;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class PageLoginStep {
@Given("I launch the application on the internet")
public void i_launch_the_application_on_the_internet() {
System.out.println("i_launch_the_application_on_the_internet");
}
@When("I enter my usename and password")
public void i_enter_my_usename_and_password() {
System.out.println("i_enter_my_usename_and_password");
}
@When("I click the login button")
public void i_click_the_login_button() {
System.out.println("i_click_the_login_button");
}
@Then("I am logged in successfully into the application")
public void i_am_logged_in_successfully_into_the_application() {
System.out.println("i_am_logged_in_successfully_into_the_application");
}
@Then("I can see a welcome message displayed")
public void i_can_see_a_welcome_message_displayed() {
System.out.println("i_can_see_a_welcome_message_displayed");
}
}