The Templates and how they interact

Orginally, Jeni created a three step approach. Once your tests are written (lets assume inside the actual XSLT to test), you would follow these steps.

  1. Process your stylesheet with the generate-tests.xsl template.

    This step transforms the <test>s into an input document for the stylesheet under test, ie, it creates the input document for step 2. We'll call these test-stylesheets. Generating the stylesheet shouldn't produce any errors, unless you've written a test wrong or generate-tests.xsl still contains bugs.

    This phase of the process can be by-passed by using pre-defined tests. This is the first contribution made to Jeni's orginal templates by David Benny.

  2. Run the generated tests (the test-stylesheet from step 1.).

    Anything can be used as the source document, or you can invoke the main template directly.

    This runs the unit tests themselves. The result is an XML document holding a report on what tests were run and their results, we'll call these the results-xml.

    You may get errors at this stage, associated with supplying invalid values for parameters for example. If the stylesheet fails any of the tests, you'll get a message telling you the ID and title of the test. The ID may be gibberish if you haven't supplied any IDs or titles, so this is a good reason to include them. If you don't get any errors or messages, then you know everything's gone smoothly.

  3. Optionally generate a HTML report.

    Finally, particularly if there were failed tests that you can't trace, you can format the XML report using format-report.xsl.

    This produces a nice HTML page (well, an HTML page) from the XML report, we'll call this one the HTML report (imaginative huh?).