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: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]