Is it possible to initialize a variable in a suite or test setup based on the return value of a keyword? I've tried this sort of syntax and it didn't work:
*** Settings ***
| Suite Setup | ${A variable}= | Set Variable | A String
I know I can call keywords like "Set Suite Variable" but they don't allow me to set the variable to the result of another keyword. I used "Set Variable" in this example, but I want to be able to call any keyword here.
Strictly speaking, no, it's not possible. Within a suite or test setup you can only call keywords, you cannot set variables to the result of other keywords directly within the setup statement .
That being said, it's easy to create a custom setup keyword that does what you want. For example:
*** Settings ***
| Suite Setup | Custom suite setup
*** Keywords ***
| Custom suite setup
| | ${A Variable}= | Set Variable | A String
| | Set suite variable | ${A Variable}
The above has the same effect as if robot supported setting variable from keywords directly in the setup. And, of course, you can call any keyword, not just Set Variable
.