Compare PDF or other file types

Hi,

I am new in Eggplant.
Is it possible to compare two PDFs (or two XMLs)?

-Can i use therefore Compare Screen as it is described here: Using Compare Screen for UI Testing ?

-If so, is it necessary that the pdf (or xml) file is visible/opened or is it enough when the file is just saved?

-And if the PDF(Xml) containes more pages(lines), or the pages (lines) do not fit to the screen, is that a problem für Eggplant Functional? How does it work? Does it scrolls automatically?

Please share your experience with those use cases :slight_smile:

Thanks in advance for your help!
Best regards

In my experience it is far better to compare parts of the xml or pdf that matter to you (you can compare a lot of parts in series). I usually do this by simply trying to find baseline captures within the new (under test) page, but Compare Screen does work well and you can define a rectangle when using it.
The problem with Compare Screen is that we usually don’t care about minor differences that tend to crop up everywhere. Though you can define areas to ignore.
Its also relatively easy to grab chunks (or all) of text and compare that, so if you don’t care too much about formatting I highly recommend
typetext controlkey, “a” //or triple-click / double-click / mousedown moveto mouseup
typetext controlkey, “c”
put the remoteclipboard into MyTestText
put “Baseline text” into MyBaselineText
Assert that MyTestText = MyBaselineText with error

It does not scroll automatically. You can increase your resolution, but that is not a reasonable solution for multiple pages of data.

I knew a guy once who used Eggplant to fire up a file comparison tool on the SUT and just look to it for an indication of pass/fail and then took a capturescreen if it was no good. Kinda funny, but it worked for him.

I suggest trying to pin down what’s really important in your files and just compare them if you can. And use a combination of tools.

Hope that helps.

If you are content to compare XML files, you can use the following:

set myFileName1 to "xml1.xml"

set myFileName2 to "xml2.xml"

open file ResourcePath(myFileName1) for reading

open file ResourcePath(myFileName2) for reading

read from file ResourcePath(myFileName1) into myFileContents1

read from file ResourcePath(myFileName2) into myFileContents2

If myFileContents1 equals myFileContents2 then
	LogSuccess "The files match."
Else
	LogWarning "The files do not match."
End If

close file ResourcePath(myFileName1)

close file ResourcePath(myFileName2)