Java 使用JUnit can';找不到步骤定义
我很难指出我的定义。它是存在的,里面有这样的东西:Java 使用JUnit can';找不到步骤定义,java,junit,cucumber,cucumber-jvm,Java,Junit,Cucumber,Cucumber Jvm,我很难指出我的定义。它是存在的,里面有这样的东西: @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() th
@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();
}
功能:标记放风筝
场景:马克在大风天放风筝[90m#WebService测试。特征:3[0m
例如:马克放了一只风筝
[33mWhen[0m[33mMark在2015年12月1日放风筝[0m
例如:风筝应该向上飞
1个场景([33m1未定义[0m)
3级台阶([33m3未定义[0m)
0m0.000s
您可以使用以下代码段实现缺少的步骤:
@给定(“^Mark放风筝$”)
公开的无效标记(字符串arg1,int arg2,int arg3,int arg4)可以扔掉{
//在这里编写代码,将上面的短语转化为具体的行动
抛出新的PendingException();
}
@当(“^风吹(\\d+-st(\\d+$”)时
公共无效风吹(int arg1,int arg2)抛出可丢弃{
//在这里编写代码,将上面的短语转化为具体的行动
抛出新的PendingException();
}
@然后(“^风筝应该飞起来$”)
公共无效风筝应飞(数据表arg1)可丢弃{
//在这里编写代码,将上面的短语转化为具体的行动
//对于自动转换,请将DataTable更改为
//列表,列表,列表或地图。
//E、K、V必须是标量(字符串、整数、日期、枚举等)
抛出新的PendingException();
}
我只是将文件复制到一个新的cucumber java框架中,并使用它而不是旧的项目。除了框架工作之外,我找不到这两个项目之间的任何区别,我不知道在哪里配置的,我的功能必须位于src/main/resources/features中 我搜索了这个功能,但什么也没找到