Alster - v. 0.5.1

File alsterTestRunner.xsl

<xsl:stylesheet version="1.0" exclude-result-prefixes="alster" extension-element-prefixes="java exsl reflect io log">
  <xsl:include href="classpath:/net/sf/nalax/xsl/nalax.xsl"/>
</xsl:stylesheet>

The alsterTestRunner.xsl stylesheet is the "engine" of the Alster XSLT unit testing framework.
Parameter Summary
<xsl:param name="testDir"/>

The testDir stylesheet parameter specifies the path of the Alster test stylesheet directory.

<xsl:param name="recurseTests"/>

The recurseTests stylesheet parameter specifies whether of not subdirectories of the directory specified by the testDir parameter are to be included in the search for Alster test stylesheets.


Template Summary
<xsl:template match="/"/>

This template hooks into the root template of the test case template.

<xsl:template name="alster:checkAlster"/>

This template ensures tests whether the XML file the enclosing stylesheet is applied to is identical to the file 'alster.xml' (which merely consists of one zero-attribute top-level element named "alster" without any descendants).

<xsl:template name="alster:runTestSuites">
  <xsl:param name="dir"/>
  <xsl:param name="recurse"/>
  <xsl:param name="package"/>
</xsl:template>

This template executes all test stylesheets in a given directory.

<xsl:template name="alster:runTestCases"/>

This template iterates over all named templates within the enclosing Alster test stylesheet.


Parameter Detail
<xsl:param name="testDir"/>

The testDir stylesheet parameter specifies the path of the Alster test stylesheet directory. It is passed to this stylesheet by the AlsterTestRunner class.


<xsl:param name="recurseTests"/>

The recurseTests stylesheet parameter specifies whether of not subdirectories of the directory specified by the testDir parameter are to be included in the search for Alster test stylesheets.


Template Detail
<xsl:template match="/"/>

This template hooks into the root template of the test case template. It either calls the template with name="alster:runTestSuites" (if and only if the testDir parameter is set), or it runs the test cases contained in the current enclosing stylesheet (if the XML file transformed is the alster.xml file). In all other cases, the template delegates to the imported root template.


<xsl:template name="alster:checkAlster"/>

This template ensures tests whether the XML file the enclosing stylesheet is applied to is identical to the file 'alster.xml' (which merely consists of one zero-attribute top-level element named "alster" without any descendants).
If this is the case, the template produces the string "1"; otherwise, it generates an error message.


<xsl:template name="alster:runTestSuites">
  <xsl:param name="dir"/>
  <xsl:param name="recurse"/>
  <xsl:param name="package"/>
</xsl:template>

This template executes all test stylesheets in a given directory. It iterates over the directory's files (and recurses into subdirectories if so specified) and applies all stylesheets whose name ends with "Test.xsl" to the XML root element.

Parameters:
dir - The path of the directory in which to execute the test stylesheets
recurse - Specifies whether the execution should be performed recursively in all subdirectories of the specified directory (it does so if the parameter has value "1" and fails to do so otherwise)
package - The name of the current package (ensures that the results can be identified with the correct source stylesheets)


<xsl:template name="alster:runTestCases"/>

This template iterates over all named templates within the enclosing Alster test stylesheet. If the name of one of these templates has namespace "alster" and begins with "test", it is considered an Alster test template and is then reflectively (via the Nalax-Reflection extension) called. The output of the thus called templates is collected into <testCase> subelements of one XML element named "testCases".


Alster - v. 0.5.1

Copyright © 2005 - 2006 Jens Voß.