XML matcher with diff?

15 views
Skip to first unread message

Franklin Chen

unread,
Feb 6, 2015, 3:24:11 PM2/6/15
to specs2...@googlegroups.com
I'm testing a program that generates XML and it will be very helpful to have matchers that do some rough semantic diff rather than reporting that two huge XML documents are not equal, which is what the current specs2 XML matchers seem to do. Has anyone implemented such matchers? I looked around and saw that XMLUnit for Java is actively maintained, so for now I may just use that for my XML testing.

etorreborre

unread,
Feb 8, 2015, 4:29:37 PM2/8/15
to specs2...@googlegroups.com
Hi Franklin,

There is indeed no such thing for specs2 at the moment. If anyone wants to propose a pull request for this I'm all ears (I don't have time to implement it at the moment).
Also I suspect that the same kind of capability would be interesting for JSON documents and there might be some code to share there.

The one thing I am curious about is how to report differences nicely. If you could paste an XMLUnit typical output here that would be nice. Is there anything you would improve there?

Thanks,

Eric.

Franklin Chen

unread,
Feb 9, 2015, 2:29:12 PM2/9/15
to specs2...@googlegroups.com
Unfortunately, XMLUnit turns out not to have a very useful diff; I had hoped it would do a real semantic diff. So it's largely a dead end.

Semantic diff of XML is actually a continuing research topic, e.g. https://dl.acm.org/citation.cfm?id=2554893

I found some ancient abandonware XML semantic diff libraries out there, and am looking into whether it might be worth my rescuing one and using it as the basis of something to plug into my test process. If not, I may just for my own purposes use a custom XML "normalizing" pretty-printing hack to put stuff on single lines in order to diff as a sequence of lines.
Reply all
Reply to author
Forward
0 new messages