Skip to content

Robot Framework 2.9 alpha 1

Pre-release
Pre-release

Choose a tag to compare

@pekkaklarck pekkaklarck released this 10 Apr 12:39
· 5620 commits to master since this release

Robot Framework 2.9 alpha 1

RF 2.9 alpha 1 is the first preview version of the forthcoming RF 2.9 release. It contains, for example, high priority enhancements related to variables and supports creating keywords with embedded arguments in test libraries. After this release the work continues with alpha 2 with keyword tagging and other interesting new features. All issues targeted for RF 2.9 can be found from the issue tracker.

Questions and comments related to this release can be sent to the robotframework-users and possible bugs submitted to the issue tracker.

We have not generated windows installers or standalone jar for this preview, but the source distribution is available from PyPI.

If you have pip just run pip install --update --pre robotframework to install or upgrade to the latest version or use pip install robotframework==2.9a1 to install exactly this version. For more details and other installation approaches see installation instructions.

Robot Framework 2.9 alpha 1 was released on Friday April 10, 2015.

Most important enhancements

Dictionary variable type (#1450)

The most noticeable feature in RF 2.9 is the new syntax to create and use dictionary (a.k.a map or hashtable) variables. Dictionaries can be returned from keywords or created in variable files, but they can also be created in the variable table:

*** Variables ***
&{DICT}    key=value    second=2    third=${3}

The above example will create a dictionary variable &{DICT} with Python dictionary {'key': 'value', 'second': '2', 'third': 3} as the value. If a dictionary variable is used as a scalar variable like ${DICT}, it will be passed forward as a single argument containing the whole dictionary. If it used like &{DICT}, individual items are passed as named arguments. For example, these two examples are equivalent:

*** Test Cases ***
Example 1
    My Keyword    key=value    second=2    third=${3}
Example 2
    My Keyword    &{DICT}

Individual dictionary variable items can be accessed either using special &{DICT}[key] syntax similarly as individual list variable items can be accessed like @{LIST}[0]. As a special feature, dictionary variables are ordered and allow accessing values also using attribute access like ${DICT.key}. For more information about dictionary variables, see Variables section the User Guide.

NOTE: RIDE editor does not currently support dictionary variables.

Python style **kwargs support with user keywords using &{kwargs} syntax (#1561)

New dictionary variable syntax can be used with user keywords to accept free keyword arguments similarly as Python based keywords can accept **kwargs. This can be accomplished simply by having a dictionary variable like &{kwargs} as the last argument in user keyword argument specification:

*** Keywords ***
Run My Process
    [Arguments]    @{arguments}    &{configuration}
    Run Process    myproc.exe    @{arguments}    &{configuration}

Also this new functionality is explained with further examples in the User Guide.

Embedded arguments in keywords defined in test libraries (#1818)

User keywords have supported embedded arguments since RF 2.1.1 (#370), and finally this functionality is supported also by library keywords. This is accomplished by giving a custom name to a keyword by setting robot_name attribute manually or by using robot.api.deco.keyword' decorator (#1835), and using${args}` in the name similarly as with user keywords. The implementing method or function must also accept same number of arguments as there are embedded argument.

from robot.api.deco import keyword

@keyword(name='User "${user}" selects "${item}" from webshop')
def select_item(user, item):
    # ...

The User Guide is, again, the place where to find more information and examples.

Other high priority enhancements and fixes

  • Scalar and list variables stored in same namespace (#1905)
  • Standard libraries do not mask third party Python modules (#1737)
  • Fixed sporadic failures with timeouts on IronPython (#1931)

Backwards incompatible changes

Being a major release, RF 2.9 contains lot of changes and some of them are backwards incompatible.

List and scalar variables stored in same namespace (#1905)

It has been possible to use a list variable @{list} as a scalar variable ${list} since RF 2.0.3 (#117), and scalar variables containing lists have been usable as list variables since RF 2.8 (#483). It has, however, been possible to also create scalar and list variables with same base name, for example, in the variable table:

*** Variables ***
${VAR}    Scalar variable
@{VAR}    List    variable

This caused a lot of confusion, and the addition of &{dictionary} variables (#1450) would have made situation even more complicated. As a result it was decided to store all variables in the same namespace (#1905) and decide how they are used depending on the format (e.g. ${var} for scalar, @{var} for list, and &{var} for dictionary).

As a result of this change, tests using scalar and list variables with same base name will need to be updated. Unfortunately there is no other good way to detect these problems than running tests with the new version and seeing does anything break.

Standard libraries not importable in Python w/o robot.libraries prefix (#1737)

It used to be possible to import Robot Framework's standard libraries in Python code by just using the library name like import DateTime. This caused problems in with standard libraries having same name as third party Python modules like DateTime.

To avoid these problems, standard libraries are not anymore directly importable in Python code. They are still importable with the robot.libraries prefix like from robot.libraries import DateTime. This has also always been the recommended way and the one used in examples in the User Guide.

Disabling command line options accepting no values by using same option again not supported anymore

Earlier it was possible to disable options accepting no values like --dryrun by giving the option again like --dryrun --other options --dryrun. This was rather confusing, and nowadays it is possible to do that by using the same option with no prefix like --nodryrun instead (#1865). If option is used with and without the no prefix, the last used value has precedence. Having same option multiple times has no special functionality anymore.

Possible equal signs in arguments to BuiltIn.Call Method need to be escaped

Call Method nowadays supports **kwags (#1603) and thus possible equal signs in normal arguments need to be escaped with a backslash like hello\=world.

Unused internal functions, classes, etc. removed

See issue #1924 for a detailed list of changes to internal APIs. These changes should not affect libraries or tools using Robot Framework's public APIs.

Other backwards incompatible changes

These changes should generally not cause problems in real life. See linked issues for more details if you think you may be affected.

  • Not possible to use keyword with embedded arguments as a normal keyword (#1962)
  • When assigning keyword return values to multiple scalar variables, an exact number of values is required (#1910)
  • Create Dictionary keyword moved from Collections to BuiltIn (#1913)
  • Keyword name conflict involving Remote library keyword causes failure and not warning (#1815)
  • Possibility to set scalar variables with lists value using Set Test/Suite/Global Variable keyword removed (#1919)
  • Deprecated syntax for repeating single keyword removed (#1775)
  • Deprecated --runmode option removed (#1923)
  • Deprecated --xunitfile option removed in favor of --xunit (#1925)
  • Deprecated way to exit for loops using custom exception with ROBOT_EXIT_FOR_LOOP attribute has been removed (#1440)

Deprecated features

Robot Framework 2.9 also deprecates some features that will be removed in the future releases. See linked issues for more details.

  • OperatingSystem.Start Process keyword deprecated in favor of much more flexible Process.Start Process (#1773)
  • Listener interface version 1.0 deprecated (#1841)
  • --runfailed and --rerunmerge options deprecated in favor of --rerunfailed and --merge, respectively (#1642)
  • Old Meta: Name syntax for specifying test suite metadata deprecated (#1918)
  • DeprecatedBuiltIn and DeprecatedOperatingSystem officially deprecated (#1774)

Acknowledgements

Big thanks for Jared Hellman (@hellmanj) for implementing both support for embedded arguments with library keywords (#1818) and custom library keyword names (#1835) required by it.

Full list of fixes and enhancements

ID Type Priority Summary
#1450 enhancement critical Dictionary variable type
#1561 enhancement critical Support Python style **kwargs with user keywords using &{kwargs} syntax
#1905 enhancement critical Store list and scalar variables in same namespace
#1737 bug high Standard libraries should not be importable in Python w/o robot.libraries prefix
#1931 bug high Timeouts can cause sporadic failures with IronPython
#1818 enhancement high Embedded arguments in keywords defined in test libraries
#1928 enhancement high Drop Python/Jython 2.5 support to ease adding support for Python 3
#1900 bug medium Log messages lost if library __init__ imports or initializes other libraries
#1908 bug medium Telnet option negotiation loop
#1440 enhancement medium Remove attribute ROBOT_EXIT_FOR_LOOP depracated in 2.8
#1603 enhancement medium Support **kwargs with BuiltIn.Call Method keywords
#1773 enhancement medium Deprecate OperatingSystem.Start Process keyword
#1774 enhancement medium Officially deprecate DeprecatedBuiltIn and DeprecatedOperatingSystem
#1826 enhancement medium Process: Better support on Jython 2.7 (termination, signals, pid)
#1835 enhancement medium Allow giving a custom name to keywords implemented using the static and the hybrid APIs
#1841 enhancement medium Deprecate old listener API
#1865 enhancement medium Support disabling command line options accepting no values using no prefix (e.g. --dryrun -> --nodryrun)
#1910 enhancement medium Require exact number of keyword return value when assigning multiple scalar variables
#1911 enhancement medium Accept list variable as a wildcard anywhere when assigning variables
#1913 enhancement medium Move Create Dictionary to BuiltIn and enhance to preserve order, allow accessing keys as attributes, etc.
#1914 enhancement medium Catenate cell values when creating scalar variable in variable table
#1927 enhancement medium Remote: Support accessing keys of returned dicts using attribute access
#1958 enhancement medium Log Many: Support logging &{dictionary} variable items
#1959 enhancement medium Wait Until Keyword Succeeds: Support giving wait time as number of times to retry
#1962 enhancement medium Disallow using keyword with embedded arguments as normal keywords
#1815 bug low Keyword name conflict involving Remote keyword should cause failure, not warning
#1906 bug low Free keyword arguments (**kwargs) names cannot contain equal signs or trailing backslashes
#1922 bug low Screenshot library causes deprecation warning with wxPython 3.x
#1642 enhancement low Deprecate --runfailed and --rerunmerge options
#1775 enhancement low Remove deprecated syntax for repeating single keyword
#1897 enhancement low Clean-up reference to RF 2.6 and older from User Guide and other documentation
#1918 enhancement low Deprecate old Meta: Name syntax for specifying test suite metadata
#1919 enhancement low Remove possibility to setting scalar variables with lists value using Set Test/Suite/Global Variable keyword
#1921 enhancement low More flexible syntax to deprecate keywords
#1923 enhancement low Remove deprecated --runmode option
#1924 enhancement low Remove unused internal functions, classes, etc.
#1925 enhancement low Remove deprecated --xunitfile option
#1929 enhancement low OperatingSystem: Enhance documentation about path separators
#1945 enhancement low Enhance documentation of Run Keyword If return values

Altogether 39 issues. See on issue tracker.