0

伙计们,

我被困在一个地方,看起来像一个语法错误,这是我的 cuke:

Feature: This is a test feature

         @stagingsearch
         Scenario Outline: Create a search and run it
                   When I create a search for profile "profilesame" for user <user>
                   Then I should see "Results"

        Examples: These are the users
        | user |
        | mol_2_1 |
        | mol_2_2 |

我收到错误说实施步骤:

When /^I create a search for profile "([^"]*)" for user mol_(\d+)_(\d+)$/ do |arg1, arg2, arg3|
  pending # express the regexp above with the code you wish you had
end

我不明白为什么黄瓜没有将示例 mol_2_1 解析为单个字符串。这里只有 2 个参数,但 cucumber 似乎很困惑,并将其作为 3 个参数。

4

1 回答 1

2

我假设您问的是实现该步骤所需的正则表达式是什么,而不是如何使 Cucumber 的建议正确?

如果该假设是正确的,那么您想要的步骤是:

When /^I create a search for profile "([^"]*)" for user (.*)$/ do |profile, user|
  pending # express the regexp above with the code you wish you had
end
于 2012-05-09T18:28:29.403 回答