黄瓜找不到特征步骤

Cucumber can't find feature steps

我正在使用 Cucumber 进行 HelloWorld 类型的测试 java。

我定义了一个特征:

    Feature: To check that main tutorial course pages have loaded in TheTestRoom.com

    Scenario: To check that the WebDriver Cucumber tutorial main page has loaded
    Given I navigate to TheTestRoom.com
    When I navigate to Cucumber Tutorial page
    Then the page title should be visible

以及这个虚拟实现

    package step_definition;

    import cucumber.api.java.en.*;
    import cucumber.api.PendingException;

    public class myFirstStepDefinition {

            @Given("^I navigate to TheTestRoom\ .com$")
            public void i_navigate_to_TheTestRoom_com() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }
            @When("^I navigate to Cucumber Tutorial page$")
            public void i_navigate_to_Cucumber_Tutorial_page() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }
            @Then("^the page title should be visible$")
            public void the_page_title_should_be_visible() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }
    }

然后我用编译步骤定义 class 并且我用 java 到 运行 测试,将编译的 class 路径添加到 class路径

    "C:\Program Files\Java\jdk-9.0.1\bin\java" -cp "C:\OutSystems\HelloWorld\dependency\*;C:\OutSystems\HelloWorld\step_definition\*" cucumber.api.cli.Main -p pretty -g step_definition C:\OutSystems\HelloWorld\feature\

但是输出好像没有找到特征步骤:

    Feature: To check that main tutorial course pages have loaded in TheTestRoom.com

    Scenario: To check that the WebDriver Cucumber tutorial main page has loaded [90m# features.feature:3[0m
    [33mGiven [0m[33mI navigate to TheTestRoom.com[0m
    [33mWhen [0m[33mI navigate to Cucumber Tutorial page[0m
    [33mThen [0m[33mthe page title should be visible[0m

    1 Scenarios ([33m1 undefined[0m)
    3 Steps ([33m3 undefined[0m)
    0m0.000s


    You can implement missing steps with the snippets below:

            @Given("^I navigate to TheTestRoom\ .com$")
            public void i_navigate_to_TheTestRoom_com() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }
            @When("^I navigate to Cucumber Tutorial page$")
            public void i_navigate_to_Cucumber_Tutorial_page() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }
            @Then("^the page title should be visible$")
            public void the_page_title_should_be_visible() throws Throwable {
                    // Write code here that turns the phrase above into concrete actions
                    throw new PendingException();
            }

关于如何解决此问题的任何想法?

猜测,但类路径不应包含第二个类路径选项中的 "step_definition" 部分。假设层次结构中只有一个 "step_definition" 文件夹而不是两个文件夹。