You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While comparing 2 dictionaries instead of 2 lists the assertion failed but the KWD status is PASS.
To reproduce the fail:
STATUS is PASSED but expected is FAIL
*** Settings ***
Library Collections
*** Variables ***
&{expectedDict} nome=mario cognome=super
*** Test Cases ***
testing kwd
Log Dictionary ${expectedDict}
Should Be True isinstance($expectedDict, dict)
Lists Should Be Equal ${expectedDict} ${expectedDict}
Name: robotframework
Version: 7.0
Please note that with 2 lists the KWD behavior is correct as you can tests via
testing lists - OK scenario
Lists Should Be Equal ${{[1,2,3]}} ${{[1,2,3]}}
testing lists - KO scenario
${status} Run Keyword And Return Status Lists Should Be Equal ${{[1,2,3]}} ${{[1,2]}}
Should Be True not $status
The text was updated successfully, but these errors were encountered:
The reason is that because dictionaries can be iterated, iteration yields keys, Robot considers them list-like and they are generally allowed to be used as lists. Also this example passes:
Lists should be equal ${{{'a': 1, 'b': 2}}} ${{['a', 'b']}}
Allowing dictionaries to be used as lists is often convenient, but it's somewhat questionable should list related keywords in Collections support them. It's possible that someone has used this functionality, for example, for validating that a dictionary has correct keys, and changing the behavior would then cause backwards compatibility issues. On the other hand, supporting dicts in this context can cause false positives and in general cause confusion. If others agree, I'd be fine with the behavior being changed, but it would be best to do it in a major release.
Hi,
I have a wrong usage of Lists Should Be Equal that leads to a false positive.
While comparing 2 dictionaries instead of 2 lists the assertion failed but the KWD status is PASS.
To reproduce the fail:
STATUS is PASSED but expected is FAIL
Name: robotframework
Version: 7.0
Please note that with 2 lists the KWD behavior is correct as you can tests via
The text was updated successfully, but these errors were encountered: