机器人框架的参数缺失
下面的内容是抱怨“删除目录”需要 1 或 2 个参数,而我没有给出任何参数。我使用的是 2.6.3,dcsLshLocation 是一个变量(在前面添加 x 不会改变错误)。我正在使用这一切的Java 版本。
*** Settings ***
| Documentation | http://jira.basistech.net:8080/browse/JEST-226
| Resource | src/main/resources/jug-shared-keywords.txt
| Force Tags | integration |
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory | ${dcsLshLocation} |
| Suite Teardown | Run Keywords | Shutdown Derby
| Test Timeout | 20 minutes
The below is rewarded with a complaint that Remove Directory requires 1 or 2 arguments and I gave it none. I'm using 2.6.3, and dcsLshLocation is a variable (and adding an x in front doesn't change the error). I'm using the Java version of all this.
*** Settings ***
| Documentation | http://jira.basistech.net:8080/browse/JEST-226
| Resource | src/main/resources/jug-shared-keywords.txt
| Force Tags | integration |
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory | ${dcsLshLocation} |
| Suite Teardown | Run Keywords | Shutdown Derby
| Test Timeout | 20 minutes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当这个问题最初被写出来时,运行关键字只能运行不带参数的关键字。但事实已不再如此。从文档中:
因此,问题中的代码可以这样表达:
以下是问题的原始答案,其他人可能仍然觉得有用。它仍然与 2.7.6 之前的机器人框架版本相关。
当您使用
运行关键字
时,您无法运行带参数的关键字。诚然,文档是一个有点不清楚,但它是这样说的:应该说的是,当您使用
Run keywords
时,每个参数都是要运行的关键字的名称。该关键字本身不能接受任何参数,因为机器人无法知道一个关键字的参数在哪里结束以及下一个关键字从哪里开始。请记住,
...
只是意味着前一行在下一行中继续,因此虽然它看起来像是每行都是带有参数的单独关键字,但事实并非如此。您的示例与以下内容相同:When this question was originally written, Run Keywords could only run keywords that do not take arguments. That is no longer true. From the documentation:
The code in the question can thus be expressed like this:
The following is the original answer to the question, which others may still find useful. It is still relevant for versions of robot framework prior to 2.7.6.
When you use
Run Keywords
, you cannot run keywords that take arguments. Admittedly the documentation is a bit unclear, but this is what it says:What it should say is that, when you use
Run Keywords
, each argument is the name of a keyword to run. This keyword cannot take any arguments itself because robot can't know where the arguments for one keyword ends and the next keyword begins.Remember that
...
simply means that the previous row is continued on the next, so while it looks like each row is a separate keyword with arguments, it's not. You example is the same as: