Revision: 3021
Author: janne.t.harkonen
Date: Fri Apr 16 04:15:39 2010
Log: initial doc for using named args
http://code.google.com/p/robotframework/source/detail?r=3021
Modified:
/trunk/doc/userguide/src/CreatingTestData/CreatingTestCases.txt
/trunk/doc/userguide/src/CreatingTestData/UsingTestLibraries.txt
=======================================
--- /trunk/doc/userguide/src/CreatingTestData/CreatingTestCases.txt Fri Apr
16 04:15:33 2010
+++ /trunk/doc/userguide/src/CreatingTestData/CreatingTestCases.txt Fri Apr
16 04:15:39 2010
@@ -113,6 +113,49 @@
their own section.
+Using arguments
+~~~~~~~~~~~~~~~
+
+Positional arguments
+''''''''''''''''''''
+
+The most common way to specify arguments to keywords is to give the values
by position.
+
+.. table:: Named argument examples
+ :class: example
+
+ +------------------+-----------------+----------------------+
+ | Test Case | Action | Argument |
+ +==================+=================+======================+
+ | Should Be Equal | 1 | 2 |
+ +------------------+-----------------+----------------------+
+
+Named arguments
+'''''''''''''''
+
+If a keyword accepts arguments that have default values, it is also
possible to
+give the arguments using named argument syntax, 'argname=value'. This is
especially
+useful if a keyword accepts multiple arguments that have default values.
+
+Consider using keyword `Start Process` from OperatingSystem library which
takes
+following arguments: `command, stdin=None, alias=None`. Using named
arguments
+it is possible to set `alias` wihtout specifying `stdin`:
+
+.. table:: Named argument examples
+ :class: example
+
+
+--------------+-----------------+----------------------+----------------------------+
+ | Test Case | Action | Argument |
Argument |
+
+==============+=================+======================+============================+
+ | Example | Start Process | ${process name} |
alias=MyAlias |
+
+--------------+-----------------+----------------------+----------------------------+
+
+This syntax can be used with user keywords and test libraries that are
implemented
+with Python and that are not using the `dynamic library API`_.
+
+.. note:: Using named arguments only works with Robot Framework 2.5 or
newer.
+
+
Test case name and documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=======================================
--- /trunk/doc/userguide/src/CreatingTestData/UsingTestLibraries.txt Sat
Apr 18 06:04:41 2009
+++ /trunk/doc/userguide/src/CreatingTestData/UsingTestLibraries.txt Fri
Apr 16 04:15:39 2010
@@ -32,6 +32,8 @@
module or package name must be used. In those cases where the library
needs arguments, they are listed in the columns after the library
name. Both the library name and arguments can be set using variables.
+Starting from Robot Framework 2.5, it is possible to set arguments
+using the `named arguments`_ syntax.
.. table:: Importing test libraries
:class: example
--
Subscription settings:
http://groups.google.com/group/robotframework-commit/subscribe?hl=en