Cucumber 尽管我定义了未定义的消息,但仍保留这些消息

Cucumber 尽管我定义了未定义的消息,但仍保留这些消息,cucumber,cucumber-java,Cucumber,Cucumber Java,当我运行Cucumber测试时,即使在实现步骤定义之后,控制台O/p也会声明步骤未定义。为什么呢 **Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Mar 21, 2019 1:28:49 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Det

当我运行Cucumber测试时,即使在实现步骤定义之后,控制台O/p也会声明步骤未定义。为什么呢

**Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Mar 21, 2019 1:28:49 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

Feature: Automation

  Scenario: Login Test                  [90m# Login.feature:3[0m
    [33mGiven [0m[33mUser opens the browser[0m
    [33mGiven [0m[33muser is on the login page[0m
    [33mThen [0m[33muser logs into the application[0m
    [33mThen [0m[33muser is in home page[0m

1 Scenarios ([33m1 undefined[0m)
4 Steps ([33m4 undefined[0m)
0m0.000s


You can implement missing steps with the snippets below:

@Given("^User opens the browser$")
public void user_opens_the_browser() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Given("^user is on the login page$")
public void user_is_on_the_login_page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^user logs into the application$")
public void user_logs_into_the_application() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^user is in home page$")
public void user_is_in_home_page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

===============================================
Suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================
从:

“如果Cucumber告诉您步骤未定义,当您定义了步骤定义时,这意味着Cucumber找不到您的步骤定义。您需要确保正确指定步骤定义的路径(粘合路径)

默认情况下,Cucumber JVM将在runner类的包(或子包)中进行搜索。您还可以显式告诉Cucumber JVM要搜索哪些包(和子包),方法是:

 @CucumberOptions(glue = {"<package>", "<package>", "<etc>"})
 public class RunCucumberTest{}
@CucumberOptions(胶水={“,”})
公共类RunCumberTest{}

需要检查两件事:

  • 在运行程序文件中检查粘合类

    @CucumberOptions(功能={“src/test/resources/features”}, glue={“为步骤定义文件提及程序包”}, plugin={“pretty”,“html:target/cumber”,“json:target/cumber/cumber.json”}, 标记={“@tag”}

  • 检查是否已将stepdef文件类(其中写入了step的定义)声明为
    private
    protected
    。它应该public


  • 是的,我已经给出了完整的目录路径,因此它无法找到步骤定义。我将路径更改为仅有效的包名称。谢谢…如果解决了您的问题,请接受答案?