You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bernhard Huber <be...@a1.net> on 2001/12/15 19:25:45 UTC

JUnit Tests for Cocoon, A Suggestion

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.

Thus some questions and suggestions:

* create a dir /test,

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

* 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.

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

Are there any other ideas?

bye bernhard



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: JUnit Tests for Cocoon, A Suggestion

Posted by Bernhard Huber <be...@a1.net>.
Thanks for the hints of Excalibur-Testcase, I will take a look.
bye bernhard



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: JUnit Tests for Cocoon, A Suggestion

Posted by giacomo <gi...@apache.org>.
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>TestCase.java, e.g.:
> /test/org/apache/cocoon/components/generation/test/SearchGeneratorTestCase.java
> * junit xml-reports are written to /test/reports

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

[C_HOME]/src/test/org/apache/.../generation/test/SearchGeneratorTestCase.java


> * 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 FooTest.java. You
should take a look into Avalon-Excalibur.

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

Devinitively look into Avalon-Excalibur.

Giacomo


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org