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

Re: Test scripts for style sheets

Subject: Re: Test scripts for style sheets
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Fri, 15 Dec 2006 00:33:26 +0100 (CET)
Re:  Test scripts for style sheets
wrew ewrwe wrote:

  Hi

> I was wondering if there is any testing suite for style
> sheets (XSLT and XSLFO).

  I've written a few stylesheets for that purpose (only to
test XSLT, not XSL-FO).  I didn't have a lot of free time to
work on them since a long time, but actually I thought to
release a first pre-version the next week.  If you are
interested, you can download them from:

    http://www.fgeorges.org/xslt-unit/xslt-unit.tar.gz

  It is for XSLT 2.0.  Take care it is a work in progress.
As for now, I think there is still a dependency on Saxon.
You can find an old page on XSLT Unit at:

    http://www.fgeorges.org/xslt-unit/xslt-unit.html

  But I wrote it a long time ago and the stylesheets evolved
since that time.  The unit test langage allow you to test
the result of an sequence constructor.  For example (see
test/hello-world.xts):

    <test:test>
      <test:expect select="'Hello, world!'" pred="eq"/>
      <xsl:sequence select="hw:hello-world()"/>
    </test:test>

  Simple tests are grouped into test groups:

    <test:tests id="hello-world-all">
      <test:title>hello-world()</test:title>
      <test:test>
        <test:title>hello-world(), arity 0</test:title>
        <test:expect test="$test:result eq 'Hello, world!'"/>
        <xsl:sequence select="hw:hello-world()"/>
      </test:test>
      <test:test>
        <test:title>hello-world(), arity 1</test:title>
        <test:expect select="'Hello, Jeni!'" pred="eq"/>
        <xsl:sequence select="hw:hello-world('Jeni')"/>
      </test:test>
    </test:tests>

  The test suite is then transformed to an XSLT stylesheet.
That stylesheet is in turn used to produce an XML report,
recording the tests performed as well as their results.  A
last transformation format the report to an HTML page:

    $ saxon test/hello-world.xts     \
            src/test-suite-gen.xsl > \
            test/test-hello-world.xsl

    $ saxon test/hello-world.xsl        \
            test/test-hello-world.xsl > \
            test/test-hello-world.xml

    $ saxon test/test-hello-world.xml   \
            src/report-to-html.xsl    > \
            test/test-hello-world.html

  There is also a driver to do all these steps at once:

    $ saxon test/hello-world.xts src/driver.xsl

  There are a lot of thing still to do, in particular
formating a nice HTML page or adding support for XSLT SA.
But I think it can already be usefull.

  I'd be please to have feedback on it, if you try it.

  Jeni Tennison has also such a tool, but I'm not able
to find it in her site right now.  You can check
http://www.jenitennison.com/.

  Regards,

--drkm






















	

	
		
___________________________________________________________________________ 
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses 
http://fr.answers.yahoo.com

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-2011 All Rights Reserved.