A document has been updated:
http://cocoon.zones.apache.org/daisy/documentation/636.html
Document ID: 636
Branch: main
Language: default
Name: Apache Cocoon Tests (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 7/3/07 11:20:34 AM
Updated by: Grzegorz Kossakowski
A new version has been created, state: publish
Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name: (unchanged)
Size: 2874 bytes (previous version: 1965 bytes)
Content diff:
(2 equal lines skipped)
<h1>Overview of testing procedures</h1>
--- <p>There are some initial procedures available for you to ensure that Apache
--- Cocoon can run properly on your particular computing platform and that the
--- components do function properly.</p>
+++ <p>Since Apache Cocoon <a href="daisy:1159">uses Apache Maven</a> automatic
unit
+++ testing is very tighly integrated with build process. We also
+++ <a href="http://vmbuild.apache.org/continuum">use Continuum</a> to ensure
that
+++ Apache Cocoon can run properly on your particular computing platform and
that
+++ the components do function properly.</p>
<p>You can build upon this infrastructure to add your own tests, and to
ensure
--- that development work proceeds smoothly. The tests are located in the
--- <tt>src/test/</tt> directory.</p>
+++ that development work proceeds smoothly. The tests for each module (block)
are
+++ located in the <tt>src/test/</tt> directory.</p>
<h1>JUnit Tests</h1>
--- <p>Run <tt>build junit-test</tt> to conduct an initial set of automated
JUnit
--- test cases, e.g. Test various transformers; Test the methods for getting
--- platform-dependent filesystem pathnames; etc.</p>
+++ <p>If you run <tt>mvn install</tt> JUnit test cases are executed
automatically
+++ and build procedure will fail if any test fails. JUnit test cases
cover:</p>
+++ <ul>
+++ <li>testing various pipeline/sitemap components (including trasformers,
matcher,
+++ generators, sources, etc.)</li>
+++ <li>testing the methods for getting platform-dependent filesystem pathnames;
+++ etc.</li>
+++ </ul>
+++
<h2>How to add more JUnit tests</h2>
<p>As there is already a nice junit framework available, it is not that
--- difficult to add junit tests for any transformer. In short:</p>
+++ difficult to add junit tests for any transformer. Let's assume that we
create
+++ test for <tt>org.apache.cocoon.transformation.XYTrasnformer</tt> class.</p>
+++ <p class="note">It is important to pay attention to class'es package and
name
+++ because test's configuration setup seekes for files that follow convention.
In
+++ order to setup all needed components and execute test as expected you need
to
+++ follow proper directory structure that is shown in an example below.</p>
+++
+++ <p>In short:</p>
+++
<ul>
--- <li>Create XYTransformerTestCase.java</li>
--- <li>Create XYTransformerTestCase.xconf</li>
--- <li>Edit the transformers section in XYTransformerTestCase.xtest for
--- XYTransformerTestCase</li>
+++ <li>Create <tt>XYTransformerTestCase.java</tt> and put it in
+++ <tt>src/test/java/org/apache/cocoon/transformation</tt></li>
+++ <li>Create <tt>XYTransformerTestCase.xtest</tt> that contains configuration
for
+++ components tested transformer needs to work with and put it in
+++ <tt>src/test/resources/og/apache/cocoon/transformation</tt></li>
<li>Add testABC() methods to XYTransformerTestCase.java</li>
</ul>
(25 equal lines skipped)