-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Feature Request: More "Should" keywords for numeric testing #5406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This would also mean, decimals have to be used. It's "funny", that Convert To Number is documented as "not precise, if you need precise, use decimal". Then why not fix it? |
Taken from https://support.virinco.com/hc/en-us/articles/207424473-Comparison-Operators Operators in NI TestStand are
Which is far more comprehensive than needed imho, just for reference. EQ and NE already implemented, I have interest just in "between inclusive". |
Better support for comparisons and for math in general would be great, but it's hard to decide what exactly we should do. A problem with comparisons is that the most convenient way to write them is like
which is rather awkward and would require adding multiple separate keywords. I see two ways this problem could be solved:
Both of these solutions require careful design if they were to be incorporated with Robot Framework core, because making changes is hard due backwards compatibility reasons. I believe with both, but especially with the latter, it would be best to start with an external library. It could be developed independently on Robot's development schedule and it wouldn't have such strict backwards compatibility requirements. We could then include the library later when it's more mature, but staying as an external library could still have benefits. Do you @ilfirin-ms have opinions or ideas related to this? Are you interested to design and implement this kind of keywords/libraries? |
Unfortunately I am not that good. I would be able to do logic, but not the proper documentation/tests/etc. Also, I wasn't thinking about external library at all. Comparison two numbers I feel should be part of standard library. I didn't get the Browser example. It looks like "Should Be True" with extra steps (for this usage). I agree Well, If we stayed at "Should Be True", which also look awkward, can solution be aliasing to "Check", "Verify", "Ensure", "Assert" or similar?
Look a bit more humanly, than
|
Standard Library only provides "Should Be Equal As Numbers" for numeric testing.
I am testing plenty of numerical values, which should fall to allowed range.
I am missing some "syntactic sugar"/"right way™" to do it, preferably one of "Should" keywords
I can do
Should Be True ${min} <= ${measured} <= ${max}
when I have min and max as separated values, often I have tuple, which lead to
Should Be True @{range_power}[0] <= ${psupply_reading.power} <= @{range_power}[1]
Or if looking for deltas
Should Be True abs(${measured} - ${reference}) <= ${allowed_delta}
in percents
Should Be True abs(100 * (${reference} - ${measured}) / ${reference}) <= ${allowed_delta_percent}
etc.
These I am using plenty and thing, there should be more explanatory/standardized syntax.
I can do custom keywords
"${measured} Should Be In Range @{range}"
etc. in own library, but feel, there should be more standard way to do it.
It does not concern only electrical values, it applies of response_time of servers and others.
The text was updated successfully, but these errors were encountered: