[英]Cucumber doesn't find Step Definition when passing a Java Enum type
I followed the example in this README: https://github.com/cucumber/cucumber-expressions#readme , but I must be doing something wrong.我按照这个自述文件中的示例进行操作: https://github.com/cucumber/cucumber-expressions#readme ,但我一定做错了什么。 The scenario file doesn't find the method in the step definitions.
场景文件在步骤定义中找不到方法。
Line in scenario file:场景文件中的行:
And I disable identity provider with name "identity provider name"
Step definition and parametertype configuration in step definition file:步骤定义文件中的步骤定义和参数类型配置:
@ParameterType("enable|disable")
public State state(String name){
return State.valueOf(name);
}
@And("^I {state} identity provider with name \"([^\"]*)\"$")
public void I_change_enabled_status_of_identity_provider_with_name(State state, final String idpName) {
METHOD BODY
}
You cannot mix up Cucumber expressions ( {state}
is a syntax of Cucumber expressions) and regular expressions (which are detected by Cucumber by locating leading ^
and trailing $
).您不能混淆 Cucumber 表达式(
{state}
是 Cucumber 表达式的语法)和正则表达式(通过定位前导^
和尾随$
由 Cucumber 检测)。
So you have to make your choice.所以你必须做出你的选择。 Whether to use Cucumber or Regular expressions.
是使用 Cucumber 还是正则表达式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.