Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/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
Robotframework Robot框架小黄瓜风格中的参数语法 如何将参数放置在测试步骤描述的中间?_Robotframework_Gherkin - Fatal编程技术网

Robotframework Robot框架小黄瓜风格中的参数语法 如何将参数放置在测试步骤描述的中间?

Robotframework Robot框架小黄瓜风格中的参数语法 如何将参数放置在测试步骤描述的中间?,robotframework,gherkin,Robotframework,Gherkin,当我创建这样一个步骤时,一切正常(参数位于该步骤的末尾): 对于这样的步骤,***测试用例***和***关键字***看起来如何: When user user1 is logged in with the following password: password1 ,其中user1是第一个参数,password1是第二个参数。使用嵌入参数时,请将它们嵌入到关键字名称中,并省略使用[arguments]。引用论点也是一种很好的做法,尽管这不是严格必要的。根据我的经验,这有助于减少歧义 以下是管道

当我创建这样一个步骤时,一切正常(参数位于该步骤的末尾):

对于这样的步骤,
***测试用例***
***关键字***
看起来如何:

When user user1 is logged in with the following password: password1

,其中user1是第一个参数,password1是第二个参数。

使用嵌入参数时,请将它们嵌入到关键字名称中,并省略使用
[arguments]
。引用论点也是一种很好的做法,尽管这不是严格必要的。根据我的经验,这有助于减少歧义

以下是管道分隔格式的示例:

*** Keywords ***
| When user "${user}" is logged in with the following password: "${password}"
| | ${result}= | Set Variable | username is ${user} and password is ${password}
| | [Return] | ${result}

*** Test Cases ***
| Example of how to use keyword with embedded arguments
| | ${result}= | When user "bob" is logged in with the following password: "superSecret!"
| | Should be equal | ${result} | username is bob and password is superSecret!

谢谢你,布莱恩·奥克利!
*** Keywords ***
| When user "${user}" is logged in with the following password: "${password}"
| | ${result}= | Set Variable | username is ${user} and password is ${password}
| | [Return] | ${result}

*** Test Cases ***
| Example of how to use keyword with embedded arguments
| | ${result}= | When user "bob" is logged in with the following password: "superSecret!"
| | Should be equal | ${result} | username is bob and password is superSecret!