OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML and unit testing

I've been considering a unit testing approach for my Regular
Fragmentations processor [1], trying to figure out what kinds of unit
testing make sense for a SAX filter [2].  I've looked at things like
JUnit [3], JXUnit [4], XSLTUnit[5], and XMLUnit[6], and I think I'm now
more confused than when I started.

In testing a filter, I need to be able to test component pieces, some of
which are plain old objects and some of which are representations of
those objects as SAX events and/or XML.  I've had a number of cases
involving shallow copying (finally fixed) where the objects looked great
at the time of their creation but morphed by the time they reached the
XML output, so I really need to be able to test these things in a
variety of situations.

So far, I've been using a set of test cases and my own eyeballs.  It's
worked pretty well as far as figuring out high-level pass/fail, but does
very little to help me track down where the pass/fail came from.

I doubt I'm the only person dealing with these kinds of issues on
xml-dev, but I still wonder if anyone's really explored how unit testing
and XML fit together.  Validation is something that comes naturally to
XML, but it's a different kind of testing than the finer-grained object
unit testing approach I'm looking for.

Simon St.Laurent
Associate Editor
O'Reilly & Associates

[1] http://simonstl.com/projects/fragment/docs/
[2] http://www.megginson.com/SAX/Java/filters.html
[3] http://junit.org
[4] http://quickutil.sourceforge.net/view/Main/JXUnit
[5] http://xsltunit.org
[6] http://sourceforge.net/projects/xmlunit/