Pergunta

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
Foi útil?

Solução

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} |
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top