Revision: 2131
Author: pekka.klarck
Date: Thu Aug 6 14:44:25 2009
Log: some cleanup
http://code.google.com/p/robotframework/source/detail?r=2131
Modified:
/trunk/doc/userguide/src/CreatingTestData/CreatingUserKeywords.txt
=======================================
--- /trunk/doc/userguide/src/CreatingTestData/CreatingUserKeywords.txt Tue
Aug 4 11:27:25 2009
+++ /trunk/doc/userguide/src/CreatingTestData/CreatingUserKeywords.txt Thu
Aug 6 14:44:25 2009
@@ -11,7 +11,6 @@
:depth: 2
:local:
-
User keyword syntax
~~~~~~~~~~~~~~~~~~~
@@ -31,13 +30,13 @@
:class: example
======================= ================= =======================
===========
- Keyword Action Argument
Argument
+ Keyword Action Argument
Argument
======================= ================= =======================
===========
- Open Login Page Open Browser \http://host/login.html \
- \ Title Should Be Login Page \
- \ \ \ \
- Title Should Start With [Arguments] ${expected} \
- \ ${title} = Get Title \
+ Open Login Page Open Browser \http://host/login.html
+ \ Title Should Be Login Page
+ \
+ Title Should Start With [Arguments] ${expected}
+ \ ${title} = Get Title
\ Should Start With ${title}
${expected}
======================= ================= =======================
===========
@@ -61,13 +60,9 @@
names. All available settings are listed below and explained later in
this section.
-__ `Settings in the test case table`_
-
`[Documentation]`:opt:
Used for setting a `user keyword documentation`__.
-__ `User keyword name and documentation`_
-
`[Arguments]`:opt:
Specifies `user keyword arguments`_.
@@ -78,6 +73,8 @@
Sets the possible `user keyword timeout`_. Timeouts_ are discussed
in a section of their own.
+__ `Settings in the test case table`_
+__ `User keyword name and documentation`_
User keyword name and documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -102,7 +99,6 @@
cause a warning when the keyoword is used. For more information, see
`Deprecating keywords`_ section.
-
User keyword arguments
~~~~~~~~~~~~~~~~~~~~~~
@@ -136,13 +132,13 @@
=============== =========== ======================== ==========
==========
Keyword Action Argument Argument
Argument
=============== =========== ======================== ==========
==========
- One Argument [Arguments] ${arg_name} \ \
- \ Log Got argument ${arg_name} \ \
- \ \ \ \ \
+ One Argument [Arguments] ${arg_name}
+ \ Log Got argument ${arg_name}
+ \
Three Arguments [Arguments] ${arg1} ${arg2}
${arg3}
- \ Log 1st argument: ${arg1} \ \
- \ Log 2nd argument: ${arg2} \ \
- \ Log 3rd argument: ${arg3} \ \
+ \ Log 1st argument: ${arg1}
+ \ Log 2nd argument: ${arg2}
+ \ Log 3rd argument: ${arg3}
=============== =========== ======================== ==========
==========
Default values
@@ -165,19 +161,19 @@
================================= ===============
===================== ===================
Keyword Action
Argument Argument
================================= ===============
===================== ===================
- One Argument With Default Value [Arguments] ${arg}=default
value \
+ One Argument With Default Value [Arguments] ${arg}=default value
\ [Documentation] This keyword
takes 0-1 arguments
- \ Log Got argument
${arg} \
- \ \
\ \
+ \ Log Got argument ${arg}
+ \
Two Arguments With Defaults [Arguments] ${arg1}=default
1 ${arg2}=default 2
\ [Documentation] This keyword
takes 0-2 arguments
- \ Log 1st argument
${arg1} \
- \ Log 2nd argument
${arg2} \
- \ \
\ \
+ \ Log 1st argument ${arg1}
+ \ Log 2nd argument ${arg2}
+ \
One Required And One With Default [Arguments]
${required} ${optional}=default
\ [Documentation] This keyword
takes 1-2 arguments
- \ Log Required:
${required} \
- \ Log Optional:
${optional} \
+ \ Log Required:
${required}
+ \ Log Optional:
${optional}
================================= ===============
===================== ===================
As all Pythonistas must have already noticed, the syntax for specifying
default arguments
@@ -202,18 +198,18 @@
=========================== =========== ================ ==========
==========
Keyword Action Argument
Argument Argument
=========================== =========== ================ ==========
==========
- Any Number Of Arguments [Arguments] @{varargs} \
\
- \ Log Many @{varargs} \
\
- \ \ \ \
\
- One Or More Arguments [Arguments] ${required} @{rest}
\
- \ Log Many ${required} @{rest}
\
- \ \ \ \
\
+ Any Number Of Arguments [Arguments] @{varargs}
+ \ Log Many @{varargs}
+ \
+ One Or More Arguments [Arguments] ${required} @{rest}
+ \ Log Many ${required} @{rest}
+ \
Required, Default, Varargs [Arguments] ${req} ${opt}=42
@{others}
- \ Log Required: ${req} \
\
- \ Log Optional: ${opt} \
\
- \ Log Others: \
\
+ \ Log Required: ${req}
+ \ Log Optional: ${opt}
+ \ Log Others:
\ : FOR ${item} IN
@{others}
- \ \ Log ${item}
\
+ \ Log ${item}
=========================== =========== ================ ==========
==========
Notice that if the last keyword above is used with more than one
@@ -227,7 +223,6 @@
Again, Pythonistas probably notice that the variable number of
arguments syntax is very close to the one in Python.
-
Embedding arguments to keyword name
'''''''''''''''''''''''''''''''''''
@@ -290,12 +285,12 @@
================ ============ ===================
=================== ===================
Test Case Action Argument
Argument Argument
================ ============ ===================
=================== ===================
- One Return Value ${ret} = Return One Value
argument \
- \ Some Keyword ${ret}
\ \
- \ \ \
\ \
+ One Return Value ${ret} = Return One Value argument
+ \ Some Keyword ${ret}
+ \
Multiple Values ${a} ${b} ${c}
= Return Three Values
- \ @{list} = Return Three Values
\ \
- \ ${scalar} @{rest} = Return Three
Values \
+ \ @{list} = Return Three Values
+ \ ${scalar} @{rest} = Return Three Values
================ ============ ===================
=================== ===================
.. table::
@@ -304,10 +299,10 @@
=================== ============ ============== ===========
==========
Keyword Action Argument Argument
Argument
=================== ============ ============== ===========
==========
- Return One Value [Arguments] ${arg} \ \
- \ Do Something ${arg} \ \
- \ ${value} = Get Some Value \ \
- \ [Return] ${value} \ \
- \ \ \ \ \
+ Return One Value [Arguments] ${arg}
+ \ Do Something ${arg}
+ \ ${value} = Get Some Value
+ \ [Return] ${value}
+ \
Return Three Values [Return] foo bar zap
=================== ============ ============== ===========
==========