0
votes

I created a keyword that concatenate two strings and return the new string, but there is something wrong that I'm not able to understand.

Set error
   [Arguments]  ${userName}  ${error}
   ${errorStr}  Catenate  ${error}  ${userName}
   log to console  ${errorStr}   #->works 'No value in database for John'
   [Return]  ${errorStr}

but when return, I have this error:

Evaluating expression 'No value in database for John' failed: SyntaxError: invalid syntax (, line 1)

1
Your code works for me, except for the fact the line starting with [Arguments] is indented correctly. When I fix that and call Set error john No value in database for, it works as expected. Please show a complete minimal reproducible example - we don't need any of the database code, just enough code to show how you are calling this keyword and using the return value. - Bryan Oakley

1 Answers

0
votes

Try like this.

[Arguments]      ${userName}  ${error}
${errorStr}=     Catenate    SEPARATOR= \     ${error}      ${userName}
Log              ${errorStr}      #->works 'No value in database for John'
[Return]         ${errorStr}