<?xml version="1.0"?>

<document>

  <properties>
    <title>Melati - Java SQL Website Development Engine</title>
    <author email="timp@paneris.org">Tim Pizey</author>
    <keywords>
      Persistence, Java, SQL, Database, Templates, Object Relational Mapping,
      Objects, Object Oriented, J2EE replacement
    </keywords>
  </properties>

  <body>


<!--
  <p align="center">
   <font size="-1"><i>
This page last updated: $Date: 2008/06/23 21:30:59 $ $Author: timp $
   </i></font>
  </p>
-->
  
<!-- menu -->

<section name=" Testing ">
<p>
The unit tests have been retro-fitted, JUnit did not exist when the code 
was first written, so the objectives of the tests are: 
</p>
<ul>
<li>to illustrate how to use public methods</li>
<li>to act as a comprehensive regression test</li>
<li>to highlight unused code </li>
</ul>
<subsection name="JUnit tests">
<p>
Maven allows tests to be run in a single thread or a new thread per test.
Running in a single thread is considerably faster.
To enable the tests to run in a single thread it is important to ensure that 
tests clean up after themselves or different results will be returned when a 
test is run on its own, in Eclipse for example, to when it is run as part of 
a suite.
To this end all database tests inherit a method to ensure that the 
number of rows in the database is unchanged.
</p>
<p>
<a href="http://junit.org/">JUnit</a> tests are incorporated into the
build:
<ol>
<li><a href="melati/surefire-report.html" title="Surefire reports">Results</a></li>
<li><a href="melati/xref-test/index.html" title="The source for the tests">Source</a></li>
<li><a href="melati/cobertura/index.html">Coverage</a></li>
</ol>

</p>
</subsection>
<subsection name=" Provoked SQLExceptions ">
<p>
The test suite uses a separate package (<a href="/throwing-jdbc/">JDBC</a>
containing  a decorated version of the <tt>java.sql</tt> API to 
cover the handling of <tt>SQLException</tt>s thrown by the JDBC connection.
</p>
<p>
The <tt>Driver</tt> and any <tt>sql</tt> object obtained from it can be 
instructed to throw an exception by use of a static method. 
This enables coverage of exception handling in a closed API.
</p>
</subsection>
<subsection name="Manual tests">
<p>
The tests below were all we had before JUnit.
A default installation should not produce errors for any of them.
<table>
<tr><td>
<a href="/melati-webapp/org.melati.test.ServletTest">ServletTest</a>
</td><td>
Simplest possible <code>Hello World</code> test.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.ConfigServletTest">ConfigServletTest</a>
</td><td>
Test that configuration (reading <code>.properties</code> files) 
is working. 
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.ConfigServletTestOverride">ConfigServletTestOverride</a>
</td><td>
Test overriding upload directory programmatically.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.CharsetServletTest">CharsetServletTest</a>
</td><td>
Test display of various characters without using a Template Engine.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.CharsetTemplateServletTest">CharsetTemplateServletTest</a>
</td><td>
Test display of various characters using a Template Engine.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.EmailTemplateServletTest">EmailTemplateServletTest</a>
</td><td>
Test Email sending utility, using a Template Engine.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.FlushingServletTest">FlushingServletTest</a>
</td><td>
Illustrate the difference between flushing and not flushing 
your output buffer.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.PoemServletTest/melatitest">PoemServletTest</a>
</td><td>
Test a Melati configuration which accesses a POEM database 
without using a Template Engine.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.TemplateServletTest">TemplateServletTest</a>
</td><td>
Test a Melati configuration with a Template Engine.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.TemplateServletTestOverride">TemplateServletTestOverride</a>
</td><td>
Illustrate
<code>org.melati.login.HttpBasicAuthenticationAccessHandler</code> 
as opposed to 
<code>org.melati.login.HttpSessionAccessHandler</code>.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.WebmacroMelatiServletTest">WebmacroMelatiServletTest</a>
</td><td>
Test Melati in standalone mode (outside the servlet API) by expanding 
a template to a string and then including it within a template.
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.WebmacroStandalone">WebmacroStandalone</a>
</td><td>
This example demonstrates using WebMacro in "standalone" mode. 
Instead of subclassing from WMServlet you create and maintain 
your own WebMacro object
and you are free to subclass from another servlet. 
(Copied from WebMacro dsitribution).
</td></tr>
<tr><td>
<a href="/melati-webapp/org.melati.test.SessionAnalysisServlet">SessionAnalysisServlet</a>
</td><td>
Shows current sessions and jvm memory usage.
</td></tr>

</table>
</p>
</subsection>
</section>
</body>
</document>






