使用JUnit的黄瓜JVM无法找到stepDefinitions

时间:2015-10-07 15:14:01

标签: java junit cucumber cucumber-jvm

我很难指向我的stepDefinitions。它存在,它的内容如下:

@Given("^Mark \"(.*)\" flew a kite$")
    public void mark_flew_a_kite(String kiteName) throws Throwable {
        kiteName = kiteName;
    }

    @When("^The wind blows (\\d+)st (\\d+)$")
    public void the_wind_blows() throws Throwable {

        json = callKiteService(200);

    }

请注意我已经更改了stackoverflow的所有实际方法名称,并且无意中使一些正则表达式不匹配。但它在实际代码中匹配!

但测试输出表明没有找到任何测试步骤,我需要全部编写它们。

Feature: Mark flies kite

Scenario: Mark flew a kite on a windy day [90m# WebServiceTest.feature:3[0m
    [33mGiven [0m[33mMark flew a kite[0m
    [33mWhen [0m[33mMark flies a kite on Dec 1st 2015[0m
    [33mThen [0m[33mThe kite should fly up[0m

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


You can implement missing steps with the snippets below:

@Given("^Mark flew a kite$")
public void mark_flew_a_kite(String arg1, int arg2, int arg3, int arg4) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^The wind blows (\\d+)st (\\d+)$")
public void the_wind_blows(int arg1, int arg2) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^The kite should fly up$")
public void kite_should_fly(DataTable arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    // For automatic transformation, change DataTable to one of
    // List<YourType>, List<List<E>>, List<Map<K,V>> or Map<K,V>.
    // E,K,V must be a scalar (String, Integer, Date, enum etc)
    throw new PendingException();
}

IDE view

1 个答案:

答案 0 :(得分:0)

我最终将文件复制到一个新的黄瓜java骨架并使用它而不是旧项目。除了骨架工作之外,我找不到两个项目之间的任何差异,我不知道我的功能必须在哪里配置我的功能必须位于src / main / resources / Features

我搜索了功能但没有找到任何内容。

Link to skeleton