Getting return variables from a keyword in RobotFramework is generally easy enough, just put a return value int he keyword and run the keyword after a variable to store the return value.
I run into a problem when I want to run that keyword conditionally. Both the Run Keyword If
and the Run Keyword Unless
keywords, as well as the Wait Until Keyword Succeeds
keyword, expect a keyword as the first argument and will throw an error if the first argument is a variable.
Currently I am working around this by setting suite level variables in the keywords I know I am going to run conditionally, but this feels kind of kludgy. Worse, I have to refactor any keyword that was not forseen needed as a conditional keyword when originally designed. Of course, I could just not use return variables, ever, and always set suite level variables, but that just makes me feel dirty.
I have not found a clean way to do this. It works, but I was hoping someone else had found a better way.