Compare two file contents

I am very new to Egg plant Functional. Before raising this question, I have searched all the indexes weather did anybody faced my problem or not. Unfortunately I couldn't.

My Question is :

How would we compare two file contents.

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    On the SUT or on the local machine? Are you trying to determine only whether the files are the same/not the same, or are you trying to determine specific differences? Are these text files? Plain text or some other format? Or are they some other kind of file? If they are not just plain text, what differences are you looking for? Just the contents or the formatting?
  • I am trying to compare two .txt files on SUT
    I am trying to compare file contents
    these two files are plain text files. Extension for these files are .txt
    i want to just compare the contents.
  • EggplantMattEggplantMatt ForumAdmin admin
    The only way to compare the contents of files on the SUT is to open one, do a select all and copy, and then use the remoteClipboard() function to pull that text into your script and save it to a variable. Then do the same thing with the other file. Then compare the two variables to see if they are the same.
  • MAZAAMAZAA Member
    akvellan wrote:
    I am trying to compare two .txt files on SUT
    I am trying to compare file contents
    these two files are plain text files. Extension for these files are .txt
    i want to just compare the contents.


    Hi akvellan,

    What are your expected results when the two contents match and does not match? As Matt suggested, it is the correct way to read the contents of one file into a variable and compare with the second content. Comparing with text files would be easy task, I feel. I am working on a similar project to compare two PDF documents for changes. :roll:
Sign In or Register to comment.