繁体   English   中英

使用黄瓜步骤定义时的歧义匹配

[英]Ambiguous match while using cucumber step definitions

需要一些帮助摆脱此错误。 黄瓜无法通过此步骤。

 And I fill in "Email" with "a1@test.com"               # features/developer_registration.feature:9
      Ambiguous match of "I fill in "Email" with "a1@test.com"":

      features/step_definitions/developer_steps.rb:9:in `/^I fill in "(.*?)" with "(.*?)"$/'
      features/step_definitions/developer_steps.rb:31:in `/^I fill in "(.*?)" with "(.*?)"$/'

这是涉及此步骤的steps.rb中的一部分。

When(/^I fill in "(.*?)" with "(.*?)"$/) do |email, password|


  fill_in "a1@test.com", with: email # express the regexp above with the code you wish you had
  fill_in "1", with: password

end

根据输出,您定义了相同的步骤。 一次在第9行,另一个在第31行。您仅显示了其中一个定义。

检查这些行上的两个定义,您可能会找到问题的根源。

我修改了以下代码,并按要求工作。

When(/^I fill in Email with "(.*?)"$/) do |email|
  fill_in "EMAIL", with: email # express the regexp above with the code you wish you had
end

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM