Revision: 3906
Author: jussi.ao.malinen
Date: Wed Aug 25 05:33:12 2010
Log: examples for exit for loop
http://code.google.com/p/robotframework/source/detail?r=3906

Modified:
 /trunk/doc/userguide/src/CreatingTestData/AdvancedFeatures.txt
 /trunk/src/robot/libraries/BuiltIn.py

=======================================
--- /trunk/doc/userguide/src/CreatingTestData/AdvancedFeatures.txt Wed Aug 25 05:10:22 2010 +++ /trunk/doc/userguide/src/CreatingTestData/AdvancedFeatures.txt Wed Aug 25 05:33:12 2010
@@ -374,7 +374,6 @@
\ \ Log ${index} \ \ \ ================ =============== ========== ========== ======= ======= =======

-
 Exiting for loop
 ''''''''''''''''

@@ -388,11 +387,24 @@
that the for loop uses. In both cases the test execution continues after the
 for loop. If executed outside of a for loop, the test fails.

-Exiting a for loop can also be initiated from a user library by raising an
-exception with :code:`ROBOT_EXIT_FOR_LOOP` attribute. Please see
-'Stopping test execution'_ for examples how to do this in Python and Java
+.. table:: Exit for loop example
+   :class: example
+
+ ============== ======== ============== ================== ===============
+      Test Case     Action    Argument        Argument            Argument
+ ============== ======== ============== ================== =============== + Exit For Loop :FOR ${var} IN @{SOME LIST} + \ Run Keyword If '${var}' == 'EXIT' Exit For Loop
+   \                         Do Something    ${var}
+ ============== ======== ============== ================== ===============
+
+Exiting a for loop can also be initiated from a keyword in a test library by
+raising an exception with :code:`ROBOT_EXIT_FOR_LOOP` attribute. Please see
+`Stopping test execution`_ for examples how to do this in Python and Java
 libraries.

+.. note:: Exit for loop functionality is new in Robot Framework 2.5.2.
+
 Repeating single keyword
 ''''''''''''''''''''''''

=======================================
--- /trunk/src/robot/libraries/BuiltIn.py       Wed Aug 25 03:57:57 2010
+++ /trunk/src/robot/libraries/BuiltIn.py       Wed Aug 25 05:33:12 2010
@@ -146,8 +146,15 @@
This keyword can be used directly in a for loop or in a keyword that
         the for loop uses. In both cases the test execution continues after
         the for loop. If executed outside of a for loop, the test fails.
+
+        Example:
+        | :FOR | ${var} | IN | @{SOME LIST} |
+        |      | Run Keyword If | '${var}' == 'EXIT' | Exit For Loop |
+        |      | Do Something   | ${var} |
+
+        New in Robot Framework 2.5.2
         """
-        # Error message is shown only if there is no eclosing for loop
+        # Error message is shown only if there is no enclosing for loop
         error = AssertionError('Exit for loop without enclosing for loop.')
         error.ROBOT_EXIT_FOR_LOOP = True
         raise error

Reply via email to