Re: [xsl] ANN: 'Testing XSLT' training course PDF available

Subject: Re: [xsl] ANN: 'Testing XSLT' training course PDF available
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 17 Dec 2007 11:55:55 +0000
On 17/12/2007, Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Dec 14 2007 12:31:37 +0000, andrew.j.welch@xxxxxxxxx wrote:
> ...
> > You mention black box testing under the unit test heading... which
> > doesn't quite fit.
> >
> > Personally I don't think you can unit test XSLT*, it's only really
> > worthwhile to test the output for a given set of inputs.
>
> Which is the sense in which I used "black box".

It's not "unit testing" then... surely?

> If the specification for the transform includes:
>
>    'art' becomes 'article' containing 'front/article-meta'.
>
> then you could use one of the unit testing frameworks to test that part
> of the specification without needing to look inside the stylesheet.  You
> could also use Schematron (Debbie Lapeyre was teaching Schematron in the
> next timeslot) or other methods to do the same thing.

Again, you can't "unit test" a transform without knowing anything
about it's internals - call it what you like but its not unit testing.

If your example requirement is to ensure that:

<art/>

becomes:

<article>
  <front>
    <article-meta>

then you could use schema aware XSLT and do:

<xsl:template match="art">
        <article xsl:type="article">

...which provided article was defined correctly in the schema it would
give you confidence that if <art/> occurred in the input that
structure would alwats be produced.

Couple that will overall result validation containing XSD 1.1 asserts
and I think that's an ideal testing framework.



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread