Open test-fullautomation opened 1 month ago
Hello Holger,
I’ve updated some of your findings by https://github.com/test-fullautomation/robotframework-documentation/pull/93 . For the others, I sent you an email last week, but you might not have had time to respond. I’m copying it below:
Regarding to Wait Thread Notification payloads, I’d like to clarify some on your feedbacks: b) Python expression as a condition: • The syntax $payloads=='test' might look unconventional, but it’s implemented this way because $payloads is part of the syntax in Robot Framework, representing a Python variable within this context (not something I came up with). Robot Framework doesn’t automatically parse Python expressions directly within condition, so writing condition=$payloads=='test' allows Python to evaluate the condition dynamically via eval(), while still ensuring compatibility with Robot Framework. • Using Robot Framework variables, such as ${payloads}, would introduce added complexity and potential performance concerns. Robot variables often require resolution and setting each time they are used, which can impact performance in condition-based evaluations. By using Python variables directly, we achieve faster, more efficient evaluations without repeated resolution steps. c) "The condition is written as a string and evaluated dynamically": • Instead of "written as a string," which can be misleading, think of this as specifying a Python expression directly. In fact, this parameter holds a Python expression that’s evaluated in real time, only when the notification is received. • "Evaluated dynamically" refers to how the condition is processed at runtime, letting users adjust conditions without altering the keyword’s source code. d) Simplifying the condition syntax: • I used $payloads here, which makes this a Python expression and means it follows Python’s syntax. So, while payloads=test might be shorter, payloads==test (or $payloads=='test' for Python) is required to meet Python syntax standards. This also maintains flexibility for any future, more complex conditions. e) Syntax difference between condition="$payloads=='test'" and condition=$payloads=='test': • Thanks for catching that. I added the double quotes unnecessarily. The correct syntax is condition=$payloads=='test'. Quotes are only needed if there’s whitespace or special characters that might confuse Robot Framework.
Thanks, Cuong