Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.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
Cucumber cuke示例语法_Cucumber - Fatal编程技术网

Cucumber cuke示例语法

Cucumber cuke示例语法,cucumber,Cucumber,各位 我被困在一个地方,看起来像是语法错误,这是我的理由: 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>

各位

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

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 |

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

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

如果该假设是正确的,您需要的步骤是:

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

我认为cucumber在示例中的下划线有问题,我不确定如何避免。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