Sunday, April 27, 2008

XQuery and Unit testing - Part I (xqUnit)

so as part of the process of learning XQuery I wanted to use a unit test approach to document my understanding. Doing some research quickly shows theres not much going on in this area, bumblebee is the most mentioned in http://jimfuller.blogspot.com/2007/09/poor-mans-unit-testing-with-xquery.html however there does not appear to be any information on the referenced site so I'm not sure it exists anymore.

Another option is mentioned at http://jimfuller.blogspot.com/2007/09/poor-mans-unit-testing-with-xquery.html which is a kind of roll-your-own solution. I think that this may be the way to go, but I want to add a few more things:
  • create the test methods on the basis on unit test best practice (if there is such a thing) this would involve some research to see if there is a meta-process for creating unit test systems - maybe xUnit will provide a template for this. I'm guessing a lot of this is premised on the testability of the harness itself (better watch out for a Gödel brick wall on this http://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems)
  • Make the functions more useful in a XQuery world, specifically being able to test if an XPath expression is true, this would allow me to test that a query result contains expected data - maybe this could be a set of expressions. This would be more powerful and flexible than just having "expected XML" output.

Anyway, some research first and then I can post up my first attempt (which will of course be pants)

No comments: