From: "Wannheden, Knut" <[EMAIL PROTECTED]> > James, > > > From: James Strachan [mailto:[EMAIL PROTECTED]] > > > > From: "Wannheden, Knut" <[EMAIL PROTECTED]> > > > > > > Would it be possible to write a different > > <test:assertEquals/> tag that > > has > > > two nested elements as its body, whose output is then > > compared? Something > > > like: > > > > > > <test:assertEquals> > > > <foo:bar/> > > > <foo:baz/> > > > </test:assertEquals> > > > > I'm sure it would be possible. Fancy submitting a patch :-)? > > > > If it would be of interest, sure!
Sure! > That sounds like a good idea. Shouldn't be too hard to realize. It's just > the equality testing code of two Documents (or Nodes) that remains... Maybe > something's floating around already. FWIW there's some useful assertion code here that could be useful... http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dom4j/dom4j/src/test/org/dom4 j/AbstractTestCase.java?rev=HEAD > > I guess another approach to this could be to parse XML using > > <x:parse> and > > then have a Document assertion. e.g. > > > > <x:parse var="doc1"> > > <foo:bar/> > > </x:parse> > > > > > > <x:parse var="doc2"> > > <foo:baz/> > > </x:parse> > > > > <test:assertDocumentsEqual expected="${doc1}" actual="${doc2}"/> > > > > Yes, I suppose this would be a way to do it, too. But I think it'd be slick > to skip the indirection over variables and the additional > <assertDocumentsEqual/>. There could be this additional > <assertOutputsEqual/> or <assertEquals/> could be reworked to either work > with the attributes actual and expected or its content. I guess the message > could still be the body text, in which case the content would be mixed, like > so: > > <test:assertEquals> > <foo:bar/> <!-- execution results in expected --> > <foo:baz/> <!-- execution results in actual --> > Bar and Baz are not equal. <!-- message --> > </test:assertEquals> > > But in case there is no output from either nested tag, I guess I would need > separate XMLOutputs afterall, no? Agreed. It might be worth having nested tags to indicate the expected and actual areas. e.g. <test:assertDocumentsEqual> <test:expected> <foo:bar/> </test:expected> <test:actual> <foo:baz/> </test:actual> </test:assertDocumentsEqual> Then this tag could be used via variables as well... <test:assertDocumentsEqual expected="${doc1"} actual="${doc2}"/> or in a mixed mode... <test:assertDocumentsEqual actual="${someDoc}"> <test:expected> <foo:bar/> </test:expected> </test:assertDocumentsEqual> James ------- http://radio.weblogs.com/0112098/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
