1

以下は、Remove Directory には 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
4

1 に答える 1

5

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:

Starting from Robot Framework 2.7.6, keywords can also be run with arguments using upper case AND as a separator between keywords. The keywords are executed so that the first argument is the first keyword and proceeding arguments until the first AND are arguments to it. First argument after the first AND is the second keyword and proceeding arguments until the next AND are its arguments. And so on.

The code in the question can thus be expressed like this:

| Suite Precondition | Run Keywords | 
|                    |   ...        | Validate SUT Installations
|                    |   ...        | AND | Launch Derby Server
|                    |   ...        | AND | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
|                    |   ...        | AND | Remove Directory  | ${dcsLshLocation}

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:

User keywords must nevertheless be used if the executed keywords need to take arguments.

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:

| 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} |
于 2011-10-25T18:09:02.347 に答える