xsl-list
[Top] [All Lists]

RE: Junit-type Framework for XSLT 2 Functions and Templates?

2005-05-16 08:18:00
FWIW, the XQuery WG has a large set of tests under development, where the
test cases are described by metadata in an XML catalog. My driver for these
tests is written in XSLT, essentially as a transformation from the test
catalog to the document that reports the test results. It does rely on
extensions: notably the ability to run a query from a stylesheet, and
importantly the ability to catch errors.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Eliot Kimber [mailto:ekimber(_at_)innodata-isogen(_dot_)com] 
Sent: 16 May 2005 15:42
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Junit-type Framework for XSLT 2 Functions and 
Templates?

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?

Cheers,

Eliot
-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8155

ekimber(_at_)innodata-isogen(_dot_)com
www.innodata-isogen.com




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--