Multiline String comparison failed

57 views
Skip to first unread message

Dinesh Rangayya

unread,
Nov 10, 2022, 12:23:48 AM11/10/22
to robotframework-users
Hi,

Can anyone confirm, how to fix this?

KEYWORD BuiltIn . Should Be Equal As Strings ${actual_schema}, ${expected_schema}

Documentation:

Fails if objects are unequal after converting them to strings.


Start / End / Elapsed:
20221109 22:57:52.144 / 20221109 22:57:52.144 / 00:00:00.000
22:57:52.144
INFO
df: org.apache.spark.sql.DataFrame = [RETAILER_KEY: int, VENDOR_KEY: int ... 9 more fields] root |-- RETAILER_KEY: integer (nullable = true) |-- VENDOR_KEY: integer (nullable = true) |-- SOURCE_TYPE: integer (nullable = true) |-- UPC_ID: string (nullable = true) |-- ATTRIBUTE_NAME: string (nullable = true) |-- ATTRIBUTE_VALUE: string (nullable = true) |-- PROCESS_KEY: long (nullable = true) |-- CREATE_DATE: string (nullable = true) |-- CREATED_BY: string (nullable = true) |-- UPDATE_DATE: string (nullable = true) |-- UPDATED_BY: string (nullable = true) != df: org.apache.spark.sql.DataFrame = [RETAILER_KEY: int, VENDOR_KEY: int ... 9 more fields] root |-- RETAILER_KEY: integer (nullable = true) |-- VENDOR_KEY: integer (nullable = true) |-- SOURCE_TYPE: integer (nullable = true) |-- UPC_ID: string (nullable = true) |-- ATTRIBUTE_NAME: string (nullable = true) |-- ATTRIBUTE_VALUE: string (nullable = true) |-- PROCESS_KEY: long (nullable = true) |-- CREATE_DATE: string (nullable = true) |-- CREATED_BY: string (nullable = true) |-- UPDATE_DATE: string (nullable = true) |-- UPDATED_BY: string (nullable = true)


22:57:52.144
FAIL

Multiline strings are different: --- first +++ second @@ -11,4 +11,5 @@ |-- CREATED_BY: string (nullable = true) |-- UPDATE_DATE: string (nullable = true) |-- UPDATED_BY: string (nullable = true) - + +

Nkina Ramonyai

unread,
Nov 10, 2022, 2:56:30 AM11/10/22
to dinesh....@gmail.com, robotframework-users
Hi Dinesh

Your syntax is incorrect because there should not be a comma in between two string, see below from https://robotframework.org/robotframework/latest/libraries/BuiltIn.html :
Multiline string comparison

Should Be Equal and Should Be Equal As Strings report the failures using unified diff format if both strings have more than two lines.

Example:

${first} =     Catenate    SEPARATOR=\n    Not in second    Same    Differs    Same
${second} =    Catenate    SEPARATOR=\n    Same    Differs2    Same    Not in first
Should Be Equal    ${first}    ${second}
Please try using this:
Run Keyword And Continue On Failure   Should Be Equal As Strings    ${actual_schema}      ${expected_schema}
Kind regards
Nkina
 
 




--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/f817b570-a5a5-4b1a-852f-6aea190290a5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages