Junit-type Framework for XSLT 2 Functions and Template
I've started doing work with XSLT 2 and I'm finding that, with the new built-in function mechanism in XSLT 2, along with all the new built-in functions string processing and what not, that I'm writing more XSLT-level functions that I have in the past (in the past I would tend to write these functions as Java extension functions).
As these functions tend to be easily testable using automated tests I naturally created another test XSLT that provides unit tests for these functions. But it's not quite as convenient as having a real unit test framework ala JUnit.
I'm wondering if anyone has thought about the best way to implement a unit testing framework for XSLT 2? The approach I'm thinking about at the moment would use one transform to process a set of unit test templates in order to generate a new transform that would run the tests and apply the results.
Another approach that might be productive would be to write a Java application that evaluates an input transform consisting of unit test templates and then applying those templates individually, under Java control (and in this case you could even make each template call part of a real JUnit unit test, letting you take advantage of support for JUnit in tools like Eclipse). But this would be a Java-centric approach and it would probably be better to have something that is pure XSLT.
I haven't pushed on it, but it would be ideal if there was some way to apply the sort of introspection approach that JUnit uses--that is, have a transform that processes itself in order to find the test case templates and run them, reporting success or failure. But I don't think there's any way to do this directly (because there's no evaluate() function in standard XSLT.
Any ideas about how best to proceed?
Eliot -- W. Eliot Kimber Professional Services Innodata Isogen 9390 Research Blvd, #410 Austin, TX 78759 (512) 372-8155
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format