You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by pa...@apache.org on 2002/07/16 05:19:20 UTC
cvs commit: jakarta-jetspeed/xdocs code-standards.xml
paulsp 2002/07/15 20:19:20
Modified: xdocs code-standards.xml
Log:
Addition of "testing" to the coding standards.
Revision Changes Path
1.4 +129 -5 jakarta-jetspeed/xdocs/code-standards.xml
Index: code-standards.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/code-standards.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- code-standards.xml 17 Feb 2001 17:27:44 -0000 1.3
+++ code-standards.xml 16 Jul 2002 03:19:20 -0000 1.4
@@ -101,7 +101,7 @@
</p>
<p>
-If you have a method with multiple parameters, seperate them across
+If you have a method with multiple parameters, separate them across
multiple lines.
</p>
@@ -125,10 +125,135 @@
</section>
+ <section name="Testing">
+ <p>
+ Testing is a great way to detect and prevent bug. By automating the
+ testing process, the test are easy to run and identify failures.
+ Jetspeed uses the testing facilities built into Ant, primarily Cactus
+ and JUnit.
+ </p>
+ <subsection name="Guidelines">
+ <ul>
+ <li>
+ The name of test class should start with <code>Test</code> and be
+ located in the package it test.
+ </li>
+ <li>
+ All new functionality should include appropriate testing. This can
+ be JUnit tests, Cactus tests, or both.
+ </li>
+ <li>
+ Fixes should also include the appropriate testing additions
+ and/or changes to detect what is being fixed, i.e. modify the test to
+ detect the problem then fix the problem. The updated test(s)
+ should confirm you fixed the problem.
+ </li>
+ <li> Run the <a href="#The Test Suite">Required Tests</a> after a <code>cvs checkout</code>, after a
+ <code>cvs update</code>, and before a <code>cvs commit</code>.
+ </li>
+ <li>
+ Run the appropriate tests the early and often.
+ </li>
+ </ul>
+ </subsection>
+ <subsection name="The Test Suite">
+ <p>
+ The required tests are made up of Cactus and JUnit test used to
+ insure working, and hopefully bug free, code.
+ </p>
+ <br/>
+ <strong>Required Tests</strong>
+ <table>
+ <tr>
+ <th>Command to run Test</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code>build unittest-all</code></td>
+ <td>Runs all required unit tests</td>
+ </tr>
+ <tr>
+ <td><code>build tests_tomcat_32</code></td>
+ <td>Runs all required Tomcat 3.x (JSP 1.1) tests</td>
+ </tr>
+ <tr>
+ <td><code>build tests_tomcat_40</code></td>
+ <td>Runs all required Tomcat 4.x (JSP 1.2) tests</td>
+ </tr>
+ </table>
+
+ <br/>
+ <strong>Unit Test Groups</strong>
+ <p>
+ These are unit tests grouped logically. In some case their is a
+ testing hierarchy. In the case of unittest-security. It is composed
+ of the security implementation test, i.e. unittest-security-registry
+ and unittest-security-turbine.
+ </p>
+ <p>
+ Below is just a sample of Unit Test Groups available
+ </p>
+ <table>
+ <caption>This is just a sample of Unit Test Groups available</caption>
+ <tr>
+ <th>Command to run Test</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code>build unittest</code></td>
+ <td>General unittests. Long running test do not belong here</td>
+ </tr>
+ <tr>
+ <td><code>build unittest-security</code></td>
+ <td>General unittests of Jetspeed Security implementations.</td>
+ </tr>
+ <tr>
+ <td><code>build tests_cache</code></td>
+ <td>General unittests of caching subsystems.</td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection name="Cactus">
+ <p>
+ Cactus testing is used when rundata is required. The test usually
+ involve generating a URL in begin<i>TestName</i>(). The URL is
+ passed to a test, named test<i>TestName</i>(), running on a web
+ server started by Cactus.
+ </p>
+ <p>
+ The execution of Cactus test are dependent on the version of the
+ servlet engine. Currently their are two place in build.xml to add
+ Cactus test.
+ </p>
+ <p>
+ Example of Cactus test can be found in <code>org.apache.jetspeed.test.BasicSecurityTest</code>
+ and <code>org.apache.jetspeed.template.TestJetspeedLink</code>.
+ </p>
+ <p>
+ Documentation for Cactus can be found at
+ <a href="http://jakarta.apache.org/cactus">http://jakarta.apache.org/cactus</a>
+ </p>
+ </subsection>
+ <subsection name="JUnit">
+ <p>
+ JUnit testing is simpler the Cactus testing, in part because the do
+ not require a webserver. These test generally test small functional
+ units, like reading a file into a data structure. Turbine services
+ also be tested with JUnit test, see <code>org.apache.jetspeed.services.registry.TestMarshallRegistry</code>.
+ </p>
+ <p>
+ Example of JUnit test can be found in <code>org.apache.jetspeed.services.registry.TestMarshallRegistry</code>
+ and <code>org.apache.jetspeed.template.TestJetspeedLinkFactory</code>.
+ </p>
+ <p>
+ Documentation for JUnit can be found at
+ <a href="http://junit.org">http://junit.org</a>
+ </p>
+ </subsection>
+ </section>
<section name="Misc.">
-
<ul>
-
<li>
File structuring. Try to keep everything organized according to the
current directory structure. For example do no put documentation
@@ -142,7 +267,6 @@
</li>
</ul>
-
</section>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>