xsl-list
[Top] [All Lists]

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

2007-12-14 06:37:01
  Mmh, what do you think, in this context, about something 
that looks like the following:

    <t:tests>
      <t:title>Fibonacci</t:title>
      <t:test>
      <t:assert expect="0" select="my:fibonacci(0)"/>
      </t:test>
      <t:test>


Clearly functions are ideal for unit testing because unlike templates they
have no context dependencies. But I think you can do it with templates too.
I often exploit the XSLT 2.0 feature that allows a stylesheet to be executed
starting at a named template; you can insert a named template that is there
solely for testing purposes, for example

<xsl:template name="test-table-rendition">
  <xsl:apply-templates select="(//table)[1]"/>
</xsl:template>

or if you prefer you can compare the output with expected results using
deep-equal().

Having said that, my main use for this technique is with a multi-phase
stylesheet, allowing each phase to be tested independently of the others.

Michael Kay
http://www.saxonica.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>
--~--