Status: Started
Owner: pekka.klarck
Labels: Type-Enhancement Priority-High Target-2.7

New issue 844 by pekka.klarck: Possibility to get variable value with default value to be used when it does not exist (`Get Variable Value` keyword)
http://code.google.com/p/robotframework/issues/detail?id=844

It is currently hard to handle a situation where you want to use a value of a variable when the variable exists and a default value when it doesn't. There is a possibility to do that but it is really complex and ugly:

${status} ${msg} = Run Keyword and Ignore Error Variable Should Exist ${var} ${value} = Set Variable If "${status}" == "PASS" ${var} default value
    Log    ${value}

We should add new `Get Variable Value` to BuiltInLibrary to make it easier to do this. This keyword should accept both the variable name and the default value to be used when the variable doesn't exist. The above could then be written simply like this:

    ${value} =    Get Variable Value    ${var}    default value
    Log    ${value}


Reply via email to