cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Cocoon Wiki] New: UnitTestingStylesheetsAndPipelines
Date Wed, 13 Oct 2004 11:13:50 GMT
   Date: 2004-10-13T04:13:50
   Editor: NicoVerwer <>
   Wiki: Cocoon Wiki
   Page: UnitTestingStylesheetsAndPipelines

   Started the page

New Page:

==  Unit-tests for stylesheets and pipelines. ==

Unit and regression testing is a best practice of software engineering.
If you don't know about unit testing and test-driven development, please have a look at these
excellent websites:
  * []
  * []
  * [ Object Mentor]

There are several tools available that will help you to do unit and regression testing, integration
testing and acceptance testing on your Cocoon applications.
For example, you can and should use
  * [ JUnit] for Java components.
  * [ HttpUnit] for testing your application 'from the outside'.
  * [ Anteater] for automating functional tests.

However, until now there was no framework for testing stylesheets and Cocoon pipelines, which
are at the core of many Cocoon applications.
For my work on several projects using Cocoon I needed such a framework, and decided that it
shouldn't be too hard to build one.
The result is Co``Unit (names like CUnit and CCUnit were already taken), which offers a simple
framework for unit tests, complementary to other tools (like JUnit and Http``Unit).

=== Installing ===

Temporarily, the code for Co``Unit is attached to this page, until it finds its way to a better

To use Co``Unit you need Cocoon 2.1.6 (which does not exist at the time of writing), or a
version from the repository after 11 October 2004.
On that date, a bug in the MountTableTransformer was fixed, which is essential to the unit-test
If you get a Null``Pointer``Exception trying to run unit tests, you need to update Cocoon,
or at least the MountTableTransformer.

Installing the framework code is simple: Just unpack it at a convenient place, like in a sub-directory
of the directory where you put all your Cocoon projects.
For example, if your Cocoon projects are in /home/user/cocoon-projects, create a sub-directory
called unit-test, and unpack in that directory.

CoUnit is typically mounted from the main sitemap, or from the main mount-table.
  * from the main sitemap:
    <map:match pattern="test/**">
      <map:mount check-reload="yes" src="/path/to/unit-test/framework/" uri-prefix="test"/>
  * from mount-table.xml:
    <mount uri-prefix="test" src="/path/to/unit-test/framework/"/>
If you plan to run unit tests for the framework itself (which I am busy adding!), use the
mount-table, because all testable components need to be mounted that way. 

=== Miscellaneous ===

If you are interested in using Co``Unit, it is a good idea to look at my presentation at the
Cocoon Get``Together 2004.

You are invited to play around with the code and improve it!
Of course, you can also add things to this Wiki page.
Please send me an email (nverwer at be-value-nl, if you add to this page I will get notified)
if you have added something that might be of interest to others, so I can keep a 'complete'
version until there is a better way (like svn) to collaborate.

View raw message