[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: ANN: 'Testing XSLT' training course PDF available

Subject: Re: ANN: 'Testing XSLT' training course PDF available
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Fri, 14 Dec 2007 15:15:42 +0100 (CET)
Re:  ANN: 'Testing XSLT' training course PDF available
Mukul Gandhi wrote:

  Hi

> I guess, Florent that your unit test scripts will duplicate
> XSLT code from the *actual* stylesheet ? Whereas, ideal
> unit testing will be (JUnit like) - the unit test script
> invokes the main stylesheet (which doesn't have any testing
> code, i.e. it's pure) and supplies some data to it (an
> input XML for e.g.), and do assertions.

  I am not sure what you mean by "duplicate".  The principle
is simply to write little pieces of code that each setups
values, exercizes the component under test and then apply
assertions on the result.  Sounds familiar ?-)

  How it is implemented is by generating XSLT stylesheets
that have a copy of the pieces of XSLT code, as well as code
generated from assertions (and others), and that imports the
tested stylesheets.

  For instance:

    <t:test>
      <xsl:variable name="input">
        ...
      </xsl:variable>
      <xsl:variable name="expected">
        ...
      </xsl:variable>
      <xsl:apply-templates select="$input" t:variable="result"/>
      <t:assert-deep expect="$expected" select="$result"/>
    </t:test>

will generates something with the same taste as:

    <xsl:import href="test-stylesheet.xsl"/>

    <xsl:template name="some-id">
      <xsl:variable name="input">
        ...
      </xsl:variable>
      <xsl:variable name="expected">
        ...
      </xsl:variable>
      <xsl:variable name="result" as="item()*">
        <xsl:apply-templates select="$input"/>
      </xsl:variable>
      <xsl:if test="not(deep-equals($expected, $result))">
        <xsl:sequence select="
	    error(xs:QName('t:ASSERT'), 'Error message')"/>
      </xsl:if>
    </xsl:template>

  I am not sure that answers your question?

  Regards,

--drkm






















      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.