fiuba08 / robotframework

Automatically exported from code.google.com/p/robotframework
Apache License 2.0
0 stars 0 forks source link

Variable that contains variables is not correctly resolved when variable is declared in the variable file #1714

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I have variable that contains the Operating-system variables ${EXECDIR} 
and ${/}, they are not correctly resolved when variables are read from resource 
file.

I did write small example, my test looks like this:
*** Settings ***
Variables         varibale.py

*** Test Cases ***
foobar
    ${other var}    Catenate    SEPARATOR=    ${EXECDIR}    ${/}    out
    Log    c:${/}tmp${/}out
    Log    ${other var}
    Log    ${MY_VAR}

and my varibale.py looks like this:
MY_VAR = "${EXECDIR}${/}tmp"

But when test case is executed C:\tmp folder, all the Log keywords output 
should look the same, but it does not. The Log    ${MY_VAR}, looks like this: 
14:58:25.590    INFO    ${EXECDIR}${/}tmp
But the other Log keywords looks like this: 14:58:25.590    INFO    C:\tmp\out

Is this a bug or expected result? I could not find answer from user Guide, are 
the variables inside a variable resolved when variables are declared in the 
variable file.

Tested with: 
C:\>pybot --version
Robot Framework 2.8.4 (Python 2.7.6 on win32)

Original issue reported on code.google.com by aalto.t...@gmail.com on 21 May 2014 at 8:16

GoogleCodeExporter commented 9 years ago
This is by design. Variables are only replaced in strings defined in test data. 
In Python code you can construct strings using other approaches. For example, 
${EXECDIR} is just '.' or os.path.abspath('.'). It is also possible to pass 
arguments both to variable files and to keywords.

Original comment by pekka.klarck on 27 May 2014 at 12:38