cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacomo <>
Subject Re: JUnit Tests for Cocoon, A Suggestion
Date Sat, 15 Dec 2001 20:25:34 GMT
On Sat, 15 Dec 2001, Bernhard Huber wrote:

> Hi,
> As I was developing a generator I was trying to write a JUnit TestCase
> for this Generator.
> I came to the conclusion that without a working cocoon.xconf, and a
> sitemap for the testcases, testing the generator is useless.
> Moreover for writing tests for other cocoon components some testing
> framework might be useful anyway.

There is the ExcaliburTestCase class for it in the
jakarta-avalon-excalibur project which enables you to build up an CM
environment for a test of Avalon components.

I think a generator can be tested easily outside a sitemap by simulating
it and gather the SAX events it generates into a Mock object and
compate those events afterwards to verify failures.

> Thus some questions and suggestions:
> * create a dir /test,

Aftter we have restructured the repository it will go into the src
directory and not into the root.

> * write testcases in
> /test/src/java<package-name>/<classname>, e.g.:
> /test/org/apache/cocoon/components/generation/test/
> * junit xml-reports are written to /test/reports

Yes, something like that. Personally I like the way and structure Avalon
uses best.


> * test case configuration is put into /test/conf, eg for
> SearchGeneratorTest the configuration files are located in
> /test/conf/org/apache/cocoon/components/generation/SearchGenerator.xconf,
> and
> /test/conf/org/apache/cocoon/components/generation/SearchGenerator.xmap.

Whenever possible use a ExcaliburTestCase and put the configuration as
Foo.xtest in the same directory as the test case class You
should take a look into Avalon-Excalibur.

> * Each JUnit test is setUp with its corresponding xconf/xmap configuration.

Devinitively look into Avalon-Excalibur.


To unsubscribe, e-mail:
For additional commands, email:

View raw message