2 new revisions:
Revision: cb2f7832cbfb
Branch: default
Author: Anssi Syrjäsalo
Date: Mon May 27 03:05:38 2013
Log: Pass Execution If to not resolve variables if the condition
false....
http://code.google.com/p/robotframework/source/detail?r=cb2f7832cbfb
Revision: bb6a6c3dbe18
Branch: default
Author: Anssi Syrjäsalo
Date: Mon May 27 03:05:45 2013
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=bb6a6c3dbe18
==============================================================================
Revision: cb2f7832cbfb
Branch: default
Author: Anssi Syrjäsalo
Date: Mon May 27 03:05:38 2013
Log: Pass Execution If to not resolve variables if the condition false.
Update issue 174
Pass Execution If keyword does not resolve variables anymore if the
condition is false. Also added an explicit test for this.
Also moved pass_execution and pass_execution_if methods into class _Control
in BuiltIn.
http://code.google.com/p/robotframework/source/detail?r=cb2f7832cbfb
Modified:
/atest/robot/running/pass_execution.txt
/atest/testdata/running/pass_execution.txt
/src/robot/libraries/BuiltIn.py
=======================================
--- /atest/robot/running/pass_execution.txt Fri May 24 02:41:12 2013
+++ /atest/robot/running/pass_execution.txt Mon May 27 03:05:38 2013
@@ -129,6 +129,9 @@
Should not pass execution if condition false
Check Test Case ${TESTNAME}
+
+Should not resolve variables if condition false
+ Check Test Case ${TESTNAME}
Should only pass successful suite setup if test case fails
Run Tests ${EMPTY} running/pass_execution_in_suite_setup.txt
=======================================
--- /atest/testdata/running/pass_execution.txt Fri May 24 02:41:12 2013
+++ /atest/testdata/running/pass_execution.txt Mon May 27 03:05:38 2013
@@ -163,6 +163,12 @@
\ Fail this should execute
Should BE Equal ${var} two
+Should not resolve variables if condition false
+ [Documentation] FAIL this should execute
+ :FOR ${var} IN one
+ \ Pass Execution If 1 == 2 message ${not_exists}
+ \ Fail this should execute
+
*** Keywords ***
=======================================
--- /src/robot/libraries/BuiltIn.py Mon May 27 02:40:07 2013
+++ /src/robot/libraries/BuiltIn.py Mon May 27 03:05:38 2013
@@ -811,77 +811,6 @@
msg = '%s: %s' % (msg, default)
return msg
- def pass_execution(self, message, *tags):
- """Skips rest of the current test, setup, or teardown with PASS
status.
-
- This keyword can be used anywhere in the test data, but the place
where
- used affects the behavior:
-
- - When used in any setup or teardown (suite, test or keyword),
passes
- that setup or teardown. Possible keyword teardowns of the started
- keywords are executed. Does not affect execution or statuses
- otherwise.
- - When used in a test outside setup or teardown, passes that
particular
- test case. Possible test and keyword teardowns are executed.
-
- Possible continuable failures before this keyword is used, as well
as
- failures in executed teardowns, will fail the execution.
-
- It is mandatory to give a message explaining why execution was
passed.
- By default the message is considered plain text, but starting it
with
- `*HTML*` allows using HTML formatting.
-
- It is also possible to modify test tags passing tags after the
message
- similarly as with `Fail` keyword. Tags starting with a hyphen
- (e.g. `-regression`) are removed and others added. Tags are
modified
- using `Set Tags` and `Remove Tags` internally, and the semantics
- setting and removing them are the same as with these keywords.
-
- Examples:
- | Pass Execution | All features available in this version tested. |
- | Pass Execution | Deprecated test. | deprecated | -regression |
-
- This keyword is typically wrapped to some other keyword, such as
- `Run Keyword If`, to pass based on a condition. The most common
case
- can be handled also with `Pass Execution If`:
-
- | Run Keyword If | ${rc} < 0 | Pass Execution | Negative values
are cool. |
- | Pass Execution If | ${rc} < 0 | Negative values are cool. |
-
- Passing execution in the middle of a test, setup or teardown
should be
- used with care. In the worst case it leads to tests that skip all
the
- parts that could actually uncover problems in the tested
application.
- In cases where execution cannot continue do to external factors,
- it is often safer to fail the test case and make it non-critical.
-
- New in Robot Framework 2.8.
- """
- message = message.strip()
- if not message:
- raise RuntimeError('Message cannot be empty.')
- self._set_and_remove_tags(tags)
- log_message, level =
self._get_logged_test_message_and_level(message)
- self.log('Execution passed with message:\n%s' % log_message, level)
- raise PassExecution(message)
-
- def pass_execution_if(self, condition, message, *tags):
- """Conditionally skips rest of the current test, setup, or
teardown with PASS status.
-
- A wrapper for `Pass Execution` to skip rest of the current test,
- setup or teardown based the given `condition`. The condition is
- evaluated similarly as with `Should Be True` keyword, and `message`
- and `*tags` have same semantics as with `Pass Execution`.
-
- Example:
- | :FOR | ${var} | IN |
@{VALUES} |
- | | Pass Execution If | '${var}' == 'EXPECTED' | Correct
value was found |
- | | Do Something | ${var} |
-
- New in Robot Framework 2.8.
- """
- if self._is_true(condition):
- self.pass_execution(message, *tags)
-
class _Variables:
@@ -1786,6 +1715,78 @@
if self._is_true(condition):
self.return_from_keyword(*return_values)
+ def pass_execution(self, message, *tags):
+ """Skips rest of the current test, setup, or teardown with PASS
status.
+
+ This keyword can be used anywhere in the test data, but the place
where
+ used affects the behavior:
+
+ - When used in any setup or teardown (suite, test or keyword),
passes
+ that setup or teardown. Possible keyword teardowns of the started
+ keywords are executed. Does not affect execution or statuses
+ otherwise.
+ - When used in a test outside setup or teardown, passes that
particular
+ test case. Possible test and keyword teardowns are executed.
+
+ Possible continuable failures before this keyword is used, as well
as
+ failures in executed teardowns, will fail the execution.
+
+ It is mandatory to give a message explaining why execution was
passed.
+ By default the message is considered plain text, but starting it
with
+ `*HTML*` allows using HTML formatting.
+
+ It is also possible to modify test tags passing tags after the
message
+ similarly as with `Fail` keyword. Tags starting with a hyphen
+ (e.g. `-regression`) are removed and others added. Tags are
modified
+ using `Set Tags` and `Remove Tags` internally, and the semantics
+ setting and removing them are the same as with these keywords.
+
+ Examples:
+ | Pass Execution | All features available in this version tested. |
+ | Pass Execution | Deprecated test. | deprecated | -regression |
+
+ This keyword is typically wrapped to some other keyword, such as
+ `Run Keyword If`, to pass based on a condition. The most common
case
+ can be handled also with `Pass Execution If`:
+
+ | Run Keyword If | ${rc} < 0 | Pass Execution | Negative values
are cool. |
+ | Pass Execution If | ${rc} < 0 | Negative values are cool. |
+
+ Passing execution in the middle of a test, setup or teardown
should be
+ used with care. In the worst case it leads to tests that skip all
the
+ parts that could actually uncover problems in the tested
application.
+ In cases where execution cannot continue do to external factors,
+ it is often safer to fail the test case and make it non-critical.
+
+ New in Robot Framework 2.8.
+ """
+ message = message.strip()
+ if not message:
+ raise RuntimeError('Message cannot be empty.')
+ self._set_and_remove_tags(tags)
+ log_message, level =
self._get_logged_test_message_and_level(message)
+ self.log('Execution passed with message:\n%s' % log_message, level)
+ raise PassExecution(message)
+
+ @run_keyword_variant(resolve=1)
+ def pass_execution_if(self, condition, message, *tags):
+ """Conditionally skips rest of the current test, setup, or
teardown with PASS status.
+
+ A wrapper for `Pass Execution` to skip rest of the current test,
+ setup or teardown based the given `condition`. The condition is
+ evaluated similarly as with `Should Be True` keyword, and `message`
+ and `*tags` have same semantics as with `Pass Execution`.
+
+ Example:
+ | :FOR | ${var} | IN |
@{VALUES} |
+ | | Pass Execution If | '${var}' == 'EXPECTED' | Correct
value was found |
+ | | Do Something | ${var} |
+
+ New in Robot Framework 2.8.
+ """
+ if self._is_true(condition):
+ self.pass_execution(message, *tags)
+
class _Misc:
==============================================================================
Revision: bb6a6c3dbe18
Branch: default
Author: Anssi Syrjäsalo
Date: Mon May 27 03:05:45 2013
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=bb6a6c3dbe18
--
---
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.