You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Too earlier evaluate the keyword's arguments of Run keywork if #62
Originally submitted to Google Code by DeonWu on 12 Aug 2008
What steps will reproduce the problem?
|Run keyword if| 1 == 2 | Log | ${MESSAGE} |
raised 'Non-existing variable '${MESSAGE}', if not defined the
'${MESSAGE}', even the keyword 'Log' never called.
The problem can avoid by adding a user keyword, like:
|Run keyword if| 1 == 2 | Log Message |
but it's more simply if to delay evaluating the arguments of called keyword.
What is the expected output? What do you see instead?
the ${MESSAGE} is evaluated in 'Log' running.
Please provide any additional information below.
following just is a temporary solution.
robot>svn di
Originally submitted to Google Code by DeonWu on 12 Aug 2008
a common way is supporting a specially tag in keywords docs.
like:
def run_keyword_if(self, expr, name, *args):
"""Runs the given keyword with the given arguments, if 'expr' is true.
@BindVarible:2:
^^^^^^^^^^^^^^^
"""
def run_keyword(self, name, *args):
"""Executes the given keyword with the given arguments.
@BindVarible:1:
^^^^^^^^^^^^^^^
""""
I understand the problem, but I don't think it's that severe. First of all there
shouldn't be that many cases where 'Run Keyword If' (or 'Run Keyword Unless') are
needed, and there are also two workarounds.
Use the variable in a user keyword. If the keyword is not executed it doesn't
matter if it uses a variable that does not exist.
Initialize the variable into some default value so that it always exists. Doesn't
fully work e.g. with list variables or with extended variable syntax, but at least it
should work in most cases.
I'm not against fixing this problem, though, but since it doesn't have too high
priority we probably won't do it in the near future. If you can provide a fix with
tests things are different. The patch in the description is a good start but it has
some problems and could be simplified. I'll comment it separately.
As an interesting coincidence, Juha noticed today that a problem with huge log files
he was investigating was at least partly caused by different 'Run Keyword' variants
resolving their arguments too early. In his case the problem was that when the final
keyword was executed, variables in its arguments where shown in resolved format in
output files. Some of the variables contained quit big values which made output files
really big.
I just submitted a new issue 67 about the new problem. The problem this issue is a
subset of that, which makes this issue a duplicate. Thanks for submitting this issue
and for the patch in the description. The final solution will have same idea
underneath, but we need to add some more logic around it. See issue 67 for details.
Activity
spooning commentedon Jun 29, 2014
a common way is supporting a specially tag in keywords docs.
like:
def run_keyword_if(self, expr, name, *args):
"""Runs the given keyword with the given arguments, if 'expr' is true.
@BindVarible:2:
^^^^^^^^^^^^^^^
"""
def run_keyword(self, name, *args):
"""Executes the given keyword with the given arguments.
@BindVarible:1:
^^^^^^^^^^^^^^^
""""
spooning commentedon Jun 29, 2014
I understand the problem, but I don't think it's that severe. First of all there
shouldn't be that many cases where 'Run Keyword If' (or 'Run Keyword Unless') are
needed, and there are also two workarounds.
Use the variable in a user keyword. If the keyword is not executed it doesn't
matter if it uses a variable that does not exist.
Initialize the variable into some default value so that it always exists. Doesn't
fully work e.g. with list variables or with extended variable syntax, but at least it
should work in most cases.
I'm not against fixing this problem, though, but since it doesn't have too high
priority we probably won't do it in the near future. If you can provide a fix with
tests things are different. The patch in the description is a good start but it has
some problems and could be simplified. I'll comment it separately.
spooning commentedon Jun 29, 2014
As an interesting coincidence, Juha noticed today that a problem with huge log files
he was investigating was at least partly caused by different 'Run Keyword' variants
resolving their arguments too early. In his case the problem was that when the final
keyword was executed, variables in its arguments where shown in resolved format in
output files. Some of the variables contained quit big values which made output files
really big.
I just submitted a new issue 67 about the new problem. The problem this issue is a
subset of that, which makes this issue a duplicate. Thanks for submitting this issue
and for the patch in the description. The final solution will have same idea
underneath, but we need to add some more logic around it. See issue 67 for details.