1

i am trying to compare two csv file data and followed below process in RIDE -

${csvA} =    Get File    ${filePathA}
${csvB} =    Get File    ${filePathB}
Should Be Equal As Strings    ${csvA}    ${csvB}

Here are my two csv contents -

csvA data

Harshil,45,8.03,DMJ
Divy,55,8,VVN
Parth,1,9,vvn
kjhjmb,44,0.5,bugg

csvB data

Harshil,45,8.03,DMJ
Divy,55,78,VVN
Parth,1,9,vvnbcb
acc,5,6,afafa

As few of the data is not in match, when i Run the code in RIDE, the result is FAIL. But in the log below data is shown -

**

Multiline strings are different:
--- first
+++ second
@@ -1,4 +1,4 @@
 Harshil,45,8.03,DMJ
-Divy,55,8,VVN
-Parth,1,9,vvn
-kjhjmb,44,0.5,bugg
+Divy,55,78,VVN
+Parth,1,9,vvnbcb
+acc,5,6,afafa**

I would like to know the meaning of ---first +++second @@-1,4+1,4@@ content. Thanks in advance!

User2014
  • 101
  • 3
  • 18

1 Answers1

4

When robot compares multiline strings (data that has newlines in it), it uses the standard unix tool diff to show the differences. Those characters are all part of what's called a unified diff. Even though you pass in raw data, it's treating the data as two files and showing the differences between the two in a format familiar to most programmers.

Here are two references to read more about the format:

In short, the @@ gives you a reference for which line numbers are different, and the + and - show you which lines are different.

In your specific example it's telling you that three lines were different between the two strings: the line beginning with Divy, the line beginning with Parth, and the line beginning with acc. Since the line beginning with Harshil does not show a + or -, that means it was identical between the two strings.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685