The framework for JUnit and other tests is explained at Cocoon doco:
Testing your Apache Cocoon
Various tests already exist: a number of JUnit tests, some Anteater functional tests, and Catalog Entity Resolver tests. Please add more and contribute patches.
See also the LenyaUnitTests - some ideas could be utilised for the core Cocoon tests.
Anteater tests
How to create new anteater tests
To create a core anteater test, just add a new script under src/test/anteater.
To create tests for a particular block, add anteater scripts under test/anteater in the block source directory (for example: src/blocks/batik/test/anteater/samples-mime-types.xml).
Pages created specifically for core tests should be put in subdirectories under src/webapp/test, see http://localhost:8888/samples/test/ for a list of such pages.
How to run Anteater tests
- Install anteater
- Set anteater.* parameters in your local.build.properties file, as needed
- Start cocoon as usual
- In another window run the anteater-tests build target
That's it.
How to run a single Anteater test
- See steps 1 - 3 in 'How to run Anteater tests'
- In another window run the anteater-test build target and use the 'target'-parameter to call the requested Anteater test script e.g. build anteater-test -Dtarget=calc