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]

Re: XML and unit testing

"Simon St.Laurent" wrote:
> 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.

Unit testing appears to be very dependent on the way you are working as
shown by the variety of answers you've got up to now.

When it comes to testing SAX producers|filters|consumers, what I would
dream to have is a set of JUnit classes to send, receive, store and
compare suites of SAX events.

A way of describing these events could be to serialize them as XML

That would require defining a XML syntax to express SAX events (using
the XML implied by the SAX events themselves wouldn't do the trick since
I guess I would want to test "non well formed" SAX events suites, such
as the effect of a startElement alone).

Another way to generate such tests could be to use a preprocessor (maybe
a XSLT transformation) that would generate the Java code calling the
methods of your SAX handler for a given XML document and to insert your
test points into this code.

If you are interested by something along these lines, I would be happy
to help!

> Simon St.Laurent
> Associate Editor
> O'Reilly & Associates
> http://simonstl.com
> [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/
> ------------------------------------------------------------------
> The xml-dev list is sponsored by XML.org, an initiative of OASIS
> <http://www.oasis-open.org>
> The list archives are at http://lists.xml.org/archives/xml-dev/
> To unsubscribe from this elist send a message with the single word
> "unsubscribe" in the body to: xml-dev-request@lists.xml.org

See you at XTech in San Diego.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org