Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 黄瓜中未定义的步骤_Java_Selenium_Automated Tests_Cucumber_Qa - Fatal编程技术网

Java 黄瓜中未定义的步骤

Java 黄瓜中未定义的步骤,java,selenium,automated-tests,cucumber,qa,Java,Selenium,Automated Tests,Cucumber,Qa,运行测试后,Cucumber说我的步骤未定义。我做错什么了吗 特色: Then I should see Error message for "ORIGIN" zipcode with key <messageKey> 我终于得到了答案。 Cumber在特征文件和步骤定义之间逐字符搜索;因此,如果您有太多的步骤共享相同的名称,并且cucumber混淆了哪些步骤为“未定义”步骤,并出现以下错误,只需更改StepDef的名称即可。 错误: “您可以使用下面的代码段实现缺少的步骤:”您能

运行测试后,Cucumber说我的步骤未定义。我做错什么了吗

特色:

Then I should see Error message for "ORIGIN" zipcode with key <messageKey>

我终于得到了答案。 Cumber在特征文件和步骤定义之间逐字符搜索;因此,如果您有太多的步骤共享相同的名称,并且cucumber混淆了哪些步骤为“未定义”步骤,并出现以下错误,只需更改StepDef的名称即可。 错误:
“您可以使用下面的代码段实现缺少的步骤:”

您能提供messageKey的示例吗?您的正则表达式匹配非常具体;你的格式就是这样,或者你需要稍微放宽一点。如果你有多个同名的步骤,那么你会得到DuplicateStepDefinitionException。我很确定我的答案中的上述步骤在您的解决方案中丢失了,因此您在运行时遇到了未定义的步骤异常
@Then("^I should see Error message for \"([^\"]*)\" zipcode with key ([^\\\"]*)$")
    public void i_should_see_Error_message_for_zipcode_with_key(String location, String messageKey)