test-fullautomation / robotframework

Generic automation framework for acceptance testing and RPA
http://robotframework.org
Apache License 2.0
1 stars 0 forks source link

Threading: Findings in documentation #102

Open test-fullautomation opened 1 month ago

test-fullautomation commented 1 month ago
  1. The pdf documentation does not contain any information about the RLock heywords.
  2. The main documentation contains the headline: “New Threading Keywords”. But what is new today, tomorrow might be old. We should avoid such time related statements within our main documentation. This is enough as headline: “Threading Keywords”.
  3. chapter `Wait Thread Notification Keyword" This part should be reworked. There are several things inside that are mistakable. a) Send Thread notification and payloads: Please Please mark this as code (\rcode{Send Thread notification}). b) Python expression as a condition: curious and long winded wording. Better: … specifying a condition in Python format. But in pure Python I would expect: payloads=='test' In Robot Framework I would expect: ${payloads}==test But $payloads=='test' is a crude and confusing mixture of both Python syntax and Robot Framework syntax. Why is it implemented in this way? c) The condition is written as a string and evaluated dynamically. What does this mean? Or in other words: What other formats than strings would be possible? Is it also thinkable to evaluate the condition statically? In my opinion this sentence is more confusing than helpful. Or we need more details about the reasons to do the evaluation in exactly this way (and not in other maybe possible ways). d) Is my understanding right, that we have only one single parameter with a fix name (payloads) available to transport values inside notifications? In this case this implementation condition=$payloads=='test' is long winded in my opinion. Why not a shorter version like this: payloads=test ? Keeping it simple. e) In the screenshot above the syntax deviates: condition=”$payloads==’test’” against condition=$payloads=='test'. Which one is the right one? If the value of condition does not contain a horizontal space of more than one blank, the double quotes around the value should not be required.
milanac030988 commented 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