Comparing two html on different builds
Server A (Test server) has the latest codebase, Server B (Staging Server) server whose codebase is always in sync with the production codebase.
Now i have to pull up for example http://www.abc.com on both servers A and server B and spit out the difference between the two pages. If there are no differences i have to report that too.
I thought i could get the page source from both, put them into a string and do StringUtils difference. I know this is not the ideal way of doing it.
Is there a more efficient way of doing the page/html comparison???
I don't think HTML comparison is a good idea on web apps. Usually in any dynamic web app, even the same page, you can have different HTML even within page refreshes on the same build using the same data. There's usually a ton of stuff that will be different. Datestamps, tracking pixels, meta-data, etc...
I think you'll have better luck with doing screenshot comparisons. For your pages, you can create a mask of regions that change with data that's out of your control, like say a date stamp, or data from an external 3rd party service. Then goto your routes, take the screenshots, they apply the corresponding mask before doing the screenshot comparisons.
Maybe you can do a XML comparison with filter.
Maybe you can try to use XML comparison with filter.