Revision: 7b83fa52221c
Branch:   default
Author:   Pekka Klärck
Date:     Sun Jan 26 17:16:47 2014 UTC
Log:      Fixed reporting continuable failures with Exit/Continue For Loop.

Update issue 1631
Status: Done
Owner: pekka.klarck
Fixed both Exit For Loop and Continue For Loop. Interestingly both were
already tested with continuable failures, but handling continuable failures
before them on the same for loop iteration was not tested.
http://code.google.com/p/robotframework/source/detail?r=7b83fa52221c

Modified:
 /atest/robot/running/continue_for_loop.txt
 /atest/robot/running/exit_for_loop.txt
 /atest/testdata/running/continue_for_loop.txt
 /atest/testdata/running/exit_for_loop.txt
 /src/robot/running/keywords.py

=======================================
--- /atest/robot/running/continue_for_loop.txt  Mon May 27 13:14:06 2013 UTC
+++ /atest/robot/running/continue_for_loop.txt  Sun Jan 26 17:16:47 2014 UTC
@@ -46,5 +46,8 @@
 Continue For Loop If False
     Check Test Case    ${TESTNAME}

-With Continuable Failure
+With Continuable Failure After
+    Check Test Case    ${TESTNAME}
+
+With Continuable Failure Before
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/robot/running/exit_for_loop.txt      Mon May 27 13:14:06 2013 UTC
+++ /atest/robot/running/exit_for_loop.txt      Sun Jan 26 17:16:47 2014 UTC
@@ -56,5 +56,8 @@
 Exit For Loop If False
     Check Test Case    ${TESTNAME}

-With Continuable Failure
+With Continuable Failure After
+    Check Test Case    ${TESTNAME}
+
+With Continuable Failure Before
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/running/continue_for_loop.txt Mon May 27 13:14:06 2013 UTC +++ /atest/testdata/running/continue_for_loop.txt Sun Jan 26 17:16:47 2014 UTC
@@ -72,14 +72,20 @@
     \    Continue For Loop If     1 == 2
     \    Fail    Should fail here

-With Continuable Failure
+With Continuable Failure After
[Documentation] FAIL Several failures occurred:\n\n1) one\n\n2) three
     :FOR    ${var}    IN    one    two    three
     \       Continue For Loop If    '${var}' == 'two'
     \       Run Keyword And Continue On Failure    Fail    ${var}
     Should Be Equal    ${var}    three

-
+With Continuable Failure Before
+ [Documentation] FAIL Several failures occurred:\n\n1) one\n\n2) two
+    :FOR    ${var}    IN    one    two
+    \       Run Keyword And Continue On Failure    Fail    ${var}
+    \       Continue For Loop
+    \       Fail    This is not executed
+    Should Be Equal    ${var}    two

 *** Keyword ***
 With Loop
=======================================
--- /atest/testdata/running/exit_for_loop.txt   Mon May 27 13:14:06 2013 UTC
+++ /atest/testdata/running/exit_for_loop.txt   Sun Jan 26 17:16:47 2014 UTC
@@ -78,13 +78,19 @@
     \    Exit For Loop If     1 == 2
     \    Fail    Should fail here

-With Continuable Failure
-    [Documentation]    FAIL    one
-    :FOR    ${var}    IN    one    two    three
-    \       Exit For Loop If    '${var}' == 'two'
+With Continuable Failure After
+ [Documentation] FAIL Several failures occurred:\n\n1) one\n\n2) two
+    :FOR    ${var}    IN    one    two    three    four
+    \       Exit For Loop If    '${var}' == 'three'
     \       Run Keyword And Continue On Failure    Fail    ${var}
-    Should Be Equal    ${var}    two
+    Should Be Equal    ${var}    three

+With Continuable Failure Before
+ [Documentation] FAIL Several failures occurred:\n\n1) one\n\n2) two\n\n3) three
+    :FOR    ${var}    IN    one    two    three    four
+    \       Run Keyword And Continue On Failure    Fail    ${var}
+    \       Exit For Loop If    '${var}' == 'three'
+    Should Be Equal    ${var}    three

 *** Keyword ***
 With Loop
=======================================
--- /src/robot/running/keywords.py      Thu Jan 23 14:00:53 2014 UTC
+++ /src/robot/running/keywords.py      Sun Jan 26 17:16:47 2014 UTC
@@ -232,8 +232,12 @@
             exception = self._run_one_round(context, self.vars, values)
             if exception:
                 if isinstance(exception, ExitForLoop):
+                    if exception.earlier_failures:
+ errors.extend(exception.earlier_failures.get_errors())
                     break
                 if isinstance(exception, ContinueForLoop):
+                    if exception.earlier_failures:
+ errors.extend(exception.earlier_failures.get_errors())
                     continue
                 if isinstance(exception, ExecutionPassed):
                     exception.set_earlier_failures(errors)

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to