Type conversion from Robot Framework to Python?

I know for a fact (per the official documentation) that non-string types, such as integers & floats, Booleans, etc. need to be encased in the “dollar sign, curly brace” syntax for comparison’s sake.

For example:

Should Be Equal    ${0b1011}    ${11}  # this would pass
Should Be Equal    ${11}        11     # this would fail

However, a co-worker and I just wrote a Python function that expects a Boolean for the first value, but we found that it works whether we pass in ${True) (Boolean) or True (string).

Q: What’s up with that? Does RF do type conversion/casting or is it Python black magic?

Yes. Robot Framework has a list of “trusty” words.

See Allow translating True and False words used in Boolean argument conversion · Issue #4400 · robotframework/robotframework · GitHub

2 Likes

Hi Greg,

Have a look at this section of the Robot Framework User Guide: 6.6 Boolean arguments

Also Should Be Equal has a link to Boolean arguments which has basically the same information

Hope that helps,

Dave.

1 Like

Thanks to both @HelioGuilherme66 and @damies13 ! I guess I hadn’t kept up with these changes.

I know that in Python 'False' != False and I don’t recall RF supporting this early on. Anyway - I learn something new all the time.

1 Like