Python version of XMLUnit?

Kent Johnson kent at kentsjohnson.com
Mon Mar 6 07:28:02 EST 2006


Benjamin Niemann wrote:
> http://www.logilab.org/projects/xmldiff
> 
> You'd still have to integrate this into your test framework though...

Thanks, that looks promising.
> 
> And I'll have a look at XMLUnit - seem's like something I could use for my
> current project ;)

XMLUnit is *very* useful. For example here is a typical assertion error:
[different] Expected attribute value '1500' but was '150' - comparing 
<HotspotModelItem height="1500"...> at 
/PageItem[1]/HotspotModelItem[1]/@height to <HotspotModelItem 
height="150"...> at /PageItem[1]/HotspotModelItem[1]/@height

Notice how it shows you exactly the error including XPath expressions to 
the node containing the error!

In Jython I use unittest, not JUnit, so instead of subclassing 
XMLTestCase I call the static methods of XLMAssert from my test cases.

Kent



More information about the Python-list mailing list