From: Jeff M. <cus...@us...> - 2002-08-29 12:17:24
|
Update of /cvsroot/mockobjects/mockobjects-java/doc/html In directory usw-pr-cvs1:/tmp/cvs-serv10521/html Added Files: alt.html changes.html coding_conventions.html downloads.html endotesting.html index.html license.html naming_conventions.html papers.html release_process.html template.txt todo.html Log Message: Add simplified build sytem for web site --- NEW FILE: alt.html --- <html> <head> <title>alt.java why?</title> </head> </html> --- NEW FILE: changes.html --- <div class="c9"> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr> <td bgcolor="#525D76"><span class= "c7"><b>0.01 (release on August 12 2001</b></span> </td> </tr> <tr> <td> <span class="c8"><br> </span> <ul> <li><img align="absmiddle" border="0" alt="update" src="images/update.jpg"> The distribution zip now includes a zip of the sources. (SMGF)</li> <li><img align="absmiddle" border="0" alt="update" src="images/update.jpg"> Improved the build process and generate the user web site from XML files using stylebook. (VMA)</li> <li><img align="absmiddle" border="0" alt="add" src="images/add.jpg"> Added a user web site (in addition to the <a href= "http://sf.net/projects/mockobjects">developer's web site</a> provided by SourceForge). Added a project description, todo and changes pages. (VMA)</li> </ul> </td> </tr> </table> </div> <br> --- NEW FILE: coding_conventions.html --- <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr> <td bgcolor="#525D76" class="c7"> <b>Forewords</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">This document describes a list of coding conventions that are required for code submissions to the project. By default, the coding conventions for most Open Source Projects should follow the existing coding conventions in the code that you are working on. For example, if the bracket is on the same line as the if statement, then you should write all your code to have that convention.</p> <table border="0" cellpadding="0" cellspacing="3" width="100%"> <tr> <td valign="top" width="28"><img alt= "Note" border="0" hspace="0" vspace="0" height="29" width="28" src= "images/note.gif"></td> <td valign="top"><span class= "c10"><i><b>If you commit code that does not follow these conventions and you are caught, you are responsible for also fixing your own code.</b></i></span> </td> </tr> </table> <br> <br> <span class="c8"></span> <p class="c9">Below is a list of coding conventions that are specific to Mock Objects, everything else not specificially mentioned here should follow the official <a href= "http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html"> Sun Java Coding Conventions</a>.</p> </td> </tr> </table> </div> <br> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr> <td bgcolor="#525D76" class="c7"><b>Mock Objects specific coding conventions</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>1. Brackets</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">For class and method declaration, brackets should begin on the <b>same</b> line. Example :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public class SomeClass { public void someMethod() { } } </pre> </td> </tr> </table> </div> <p class="c9">Brackets for blocks of code inside methods should begin and end on the <b>same</b> line (this applies to <code class= "c14">if</code>, <code class= "c14">for</code>, <code class= "c14">while</code>, <code class= "c14">try/catch</code>, ...). Example :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void someMethod() { if (expression) { } else if (other_expression) { } try { } catch (Exception e) { } } </pre> </td> </tr> </table> </div> <p class="c9"><b>Brackets are mandatory even for single line statements !</b></p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> // Incorrect if (expression) // some code // Correct if (expression) { // some code } </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>2. Blank Spaces</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">keywords followed by a parenthesis should be separated by a space. Example :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> while (true) { // some code } </pre> </td> </tr> </table> </div> <p class="c9">Blank space should appear after commas in argument lists. Binary operators should be separated from their operands by spaces :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> a += c + d; a = (a + b) / (c * d); while (d++ = s++) { n++; } printSize("size is " + foo + "\n"); </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>3. Indentations</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9"><b>4 spaces. NO tabs</b>. Period. We understand that a lot of you like to use tabs, but the fact of the matter is that in a distributed development environment, when the cvs commit messages get sent to a mailing list, they are almost impossible to read if you use tabs.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>4. Comments</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Javadoc SHOULD exist on all your class members (methods + class variables), including the private ones. Also, if you are working on existing code and there currently isn't a javadoc for that method/class/variable or whatever, then you should contribute and add it. This will improve the project as a whole.</p> <p class="c9">Also add code comments when you think it's necessary (like assumptions), especially when the code is not obvious.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>5. License</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">The Jakarta Apache/Cactus License MUST be placed at the top of each and every file.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>6. Author references</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">If you contribute to a file (code or documentation), add yourself to the top of the file (below the existing authors). For java files the preferred Javadoc format is:</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> @author <a href="mailto:us...@do...">John Doe</a> </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>7. Class variables</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Class variables should be prefixed with <b>my</b>. Example :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public class SomeClass { private String myString; [...] public void someMethod() { logger.debug("Value = " + myString); } } </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>8. Parameter names</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Method parameters should be prefixed by "<code class= "c14">a</code>" (for differentiating them from inner variables). For example :</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void someMethod(String aClassName) { String className; // inner variable } </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>9. Line length</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Avoid lines longer than 78 characters for Code, comments, ...</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c11"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c12"> <b>10. Versionning</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">All .java files should have a <code class= "c14">@version</code> tag like the one below.</p> <div class="c13"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> @version $Id: coding_conventions.html,v 1.1 2002/08/29 12:17:21 custommonkey Exp $ </pre> </td> </tr> </table> </div> <table border="0" cellpadding="0" cellspacing="3" width="100%"> <tr> <td valign="top" width="28"> <img alt="Note" border="0" hspace="0" vspace="0" height= "29" width="28" src= "images/note.gif"></td> <td valign="top"><span class= "c10"><i>You just need to write <code class="c14">@version $Id: coding_conventions.xml,v 1.4 2001/08/22 10:36:45 vmassol Exp $</code> and CVS will add the rest during commits</i></span> </td> </tr> </table> <br> <br> <span class="c8"></span> </td> </tr> </table> </div> <span class="c8"><br> </span> </td> </tr> </table> </div> <br> --- NEW FILE: downloads.html --- <h1>Packages</h1> <p> All files can be downloaded from the <a href="http://sourceforge.net/projects/mockobjects">SourceForge developer's page</a>. There are currently 4 packages from which you can download files. A package is simply a set of files (this is the SourceForge notion) :</font></p> <ul> <li> <b>mockobjects-java</b> : Contains the core framework and mock implementations for the Java platform (<code><font face="courier, monospaced">java.*</font></code> and <code><font face="courier, monospaced">javax.*</font></code> APIs). It is composed of the following files :</font> <ul> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mockobjects_<version>.zip</font></code></b> : contains source and documentation</font></li> </ul> </li> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mockobjects-visualage</font></code></b> : Contains a mock implementation for the VisualAge Tools API. It is composed of the following files :</font> <ul> <li><font color="#000000" face= "arial,helvetica,sanserif"><none> <i>[to be available soon]</i></font></li> </ul> </li> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mockobjects-atg-dynamo</font></code></b> : Contains a mock implementation for some proprietary ATG Dynamo classes. It is composed of the following files :</font> <ul> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mo_atg_dynamo_<version>.jar</font></code></b> : contains the source files</font></li> </ul> </li> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mockobjects-dev</font></code></b> : Contains some tools to help build the project from it's source. This is for developers only is not not needed to use the framework. These tools work against the CVS mockobjects-java module and not against the sources that can be found in the previously mentionned files. The next release of the project (0.01) will clearly separate the user files (runtime jars + documentation) from the developer files (source + build process). It is composed of the following files :</font> <ul> <li><font color="#000000" face= "arial,helvetica,sanserif"><b><code><font face= "courier, monospaced">mockobjects-java-ant-<version>.zip</font></code></b> : A prepackaged version of Ant containing the needed tasks (Stylebook, ...) to build the project from it's sources.</font></li> </ul> </li> </ul> <h1>Releases</h1> Click <a href= "http://sourceforge.net/projects/mockobjects">here</a> for Mock Objects releases. --- NEW FILE: endotesting.html --- <h1>Endo-Testing: Unit Testing with Mock Objects</h1> <p> <i>This paper was presented at the conference, "eXtreme Programming and Flexible Processes in Software Engineering - XP2000". (c) 2000 Tim Mackinnon, Steve Freeman, Philip Craig. To be published in</i> XP eXamined by Addison-Wesley. The original paper is available <a href="misc/mockobjects.pdf">here</a> (PDF format).</p> <p><i>Unit testing is a fundamental practice in Extreme Programming, but most nontrivial code is difficult to test in isolation. It is hard to avoid writing test suites that are complex, incomplete, and difficult to maintain and interpret. Using Mock Objects for unit testing improves both domain code and test suites. They allow unit tests to be written for everything, simplify test structure, and avoid polluting domain code with testing infrastructure.</i></p> [...1074 lines suppressed...] <hr size="1" noshade=""> <i>Copyright © 2001 Mock Objects. All Rights Reserved.</i> </body> </html> --- NEW FILE: index.html --- <h1>Project description and goals</h1> <p> The <a href= "http://www.mockobjects.com">Mock Objects</a> project is a generic unit testing framework whose goal is to facilitate developing unit tests in the mock object style. The goal of this project is to provide: </p> <ul> <li> A core mock objects framework. This is a library of code that supports the implementation of mock objects. It is based around a set of expectation classes for values and collections. There are also various other classes to make mock objects easier to write or to use. </li> <li> A methodology for developing and using mock objects. </li> <li> A default set of mock implementation for the standard Java platform APIs. We have made a start on packages such as servlets, sql, and io. </li> <li> Mock implementations for more specialised libraries, particularly third party products. So far, we have started on ATG Dynamo and IBM's VisualAge for Java tools API. </li> <li> A community for exchanging ideas on anything related to unit testing, with a bias towards Mock Objects. </li> </ul> <p> Our larger goal is to make <a href= "www.mockobjects.com">www.mockobjects.com</a> the point of reference for ideas and tools for unit testing particularly based on Mock Objects. Our first implementation is in Java, largely because that's what we've been working in, but also because it has a stable set of APIs that are suitable for writing Mock Objects. We have applied these techniques to other environments and intend to publish the results here. </p> <h1>Latest news and announcements</h1> <table cellpadding="2" cellspacing="2" border="0" width="100%"> <tr> <td align="left" valign="top" rowspan=" 1" colspan="1" bgcolor="#a0ddf0"> <span class=" c11">2002/08/28 </span> </td> <td align="left" valign="top" rowspan=" 1" colspan="1" bgcolor="#a0ddf0"> <span class="c11">0.4 <a href=" http://sourceforge.net/project/showfiles.php?group_id=18189&release_id=101526">release</a> available. Kinda like the interim release but better.</span> </td> </tr> <tr> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class= "c11">2002/05/02 </span> </td> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class="c11">Interim release <a href= "mockobjects-cvsroot.tar.gz">Tarball</a> available. Not an official release but this snap shot has a lot of new mocks in it and is a must for j2ee development.</span> </td> </tr> <tr> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class= "c11">2001/09/08 </span> </td> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class="c11">Added a new section for papers on Mock Objects </span> </td> </tr> <tr> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class= "c11">2001/08/06 </span> </td> <td align="left" valign="top" rowspan= "1" colspan="1" bgcolor="#a0ddf0"> <span class="c11">The Mock Objects project now has a user web site. We are committed to building a thriving framework and community around Mock Objects. Of course we're looking for help ... </span> </td> </tr> </table> <p class="c9"> <a href="http://sourceforge.net"><img align="right" hspace="4" vspace="4" border="0" alt="SourceForge Logo" src= "http://sourceforge.net/sflogo.php?group_id=18189"></a> </p> --- NEW FILE: license.html --- <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr> <td bgcolor="#525D76" class="c7"><b>Mock Objects Public License</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <div class="c9"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must not be * used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <br> --- NEW FILE: naming_conventions.html --- <div class="c13"> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <tr> <td bgcolor="#525D76" class="c7"><b>Mock Object Naming Conventions</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Over time we have developed some naming conventions for how we write mock objects which we believe make them easier to work with.</p> <div class="c13"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c10"> <b>Creating expectations</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">We have built up a library of expectation classes to help with the development of mock objects. Each expectation object will compare pre-loaded expected values with actual values as they arrive. Where possible, the comparison will be made as the actual object is set, which helps to locate errors when they occur. Each expectation class has a constructor that takes a name value. This name will be displayed when an assertion fails, so it should help to identify the source of any error. For example, the instance variables for the mock sql statement include:</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockStatement.closeCalls"); protected ExpectationCounter myExecuteCalls = new ExpectationCounter("MockStatement.executeCalls"); protected ExpectationValue myQueryString = new ExpectationValue("MockStatement.queryString"); </pre> </td> </tr> </table> </div> <p class="c9">Note that the variables have the name of the thing they test, <code class= "c12">myQueryString</code> rather than <code class= "c12">myExpectedQueryString</code>. This is to avoid repetitions such as :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> myExpectedQueryString.setExpected(aString); </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c13"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c10"> <b>Setting expectations</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">All expectations are set with a method beginning <code class= "c12">setExpected<condition>,</code> where <code class= "c12"><condition></code> is a state or behaviour that will be verified during or at the end of the test. For example,</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> myMockHttpResponse.setExpectedContentType("text/plain"); </pre> </td> </tr> </table> </div> <p class="c9">says that the <code class="c12">HttpResponse</code> expects to have its content type set to <code class= "c12">"text/plain"</code> during the test.</p> <p class="c9">If an expectation that a mock object supports is not set, then it will not be verified, this makes it easier to use a mock object for multiple tests. To check that a value is not changed during a test, each Expectation type supports the method <code class= "c12">setExpectNothing</code>. For example, to test that no properties of a bean have been set its mock implementation might include the method :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void setExpectNoPropertiesSet() { myProperties.setExpectNothing(); } </pre> </td> </tr> </table> </div> <p class="c9">The expectation collections include methods for adding single objects and collections of objects. This is to allow clients to set an expectation that is itself a collection object, perhaps to check the identity of an array, rather than its contents. When using a collection expectation in a mock object please be clear in your expectations whether you are adding to or overriding the current expected values. For example, the method :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void addExpectedProperty(String property) { myProperties.addExpected(property); } </pre> </td> </tr> </table> </div> <p class="c9">adds an additional property that the mock object will expect to receive. The method :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void setExpectedProperty(String property) { myProperties.setExpectNothing(); myProperties.addExpected(property); } </pre> </td> </tr> </table> </div> <p class="c9">resets the property expectation.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c13"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c10"> <b>Setting actual values</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">The actual values for comparison against the expected values will be set in the mock implementations of real methods. For example, we count the number of times <code class= "c12">close</code> is called in a mock sql statement in the method :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void close() throws SQLException { myCloseCalls.inc(); } </pre> </td> </tr> </table> </div> <p class="c9">similarly, to set a positional parameter in a mock prepared statement :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void setObject(int param, Object obj) throws SQLException { mySetParameters.addActual(new MapEntry(new Integer(param), obj)); } </pre> </td> </tr> </table> </div> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c13"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c10"> <b>Setting stub values</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Many mock objects are used for both validation of expectations and as stub implementations to allow tests to run without external dependencies. For example, we often need to set parameters values in a mock servlet request for the target code to retrieve; these properties values are not verified because we are testing how they are used, not how they are set. The setter method is :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void setupAddParameter(String paramName, String value) { setupAddParameter(paramName, new String[] { value }); } </pre> </td> </tr> </table> </div> <p class="c9">Our convention is that stub methods start with <code class= "c12">setup<state></code> to distinguish them from Java setter methods which have the format <code class= "c12">set<state></code>. Stub values are used by mock implementations of real methods.</p> <p class="c9">One unusual stub setting we use quite often is to force exceptions to be thrown. For example, the mock sql statement includes the method :</p> <div class="c11"> <table cellpadding="2" cellspacing="2" border="1"> <tr> <td> <pre> public void setupThrowExceptionOnExecute(SQLException exception); </pre> </td> </tr> </table> </div> <p class="c9">The statement stores the given exception object and throws it when <code class= "c12">execute()</code> is called. This technique is sometimes the only way to test certain types of failure.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> </td> </tr> </table> </div> <br> --- NEW FILE: papers.html --- <h1>Papers</h1> <p> This is a collection of papers on Mock Objects style and practice.</p> <ul> <li><a href= "papers/jdbc_testfirst.html">Developing JDBC applications test-first</a> <p> Many developers find unit testing software with third-party components, such as databases, hard to do. It also shows how an approach based on Mock Objects can lead to more rigourous unit testing and, I believe, better structured code than working with a real database. <i>Steve Freeman</i></p> </li> </ul> --- NEW FILE: release_process.html --- <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width= "100%"> <tr> <td bgcolor="#525D76" class="c7"><b>Introduction</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">This document highlights our release process. It defines all the steps that need to be performed <b>before</b> releasing a new version of the Mock Objects project.</p> </td> </tr> </table> </div> <br> <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width= "100%"> <tr> <td bgcolor="#525D76" class="c7"><b>General steps</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c11"><b>Decide on the content of a release</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Long before any release, we need to define what will go into that release, i.e. the list of tasks that need to be performed <b>prior</b> to that release. These tasks will be listed on the <a href="todo.html">Todo page</a>. Tasks can be proposed on the <a href= "http://sourceforge.net/mail/?group_id=18189">mailing list</a>.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c11"><b>Deciding on doing a release</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">Releasing a version is a community action that we all need to decide together (the committers of the project). Before <b>any</b> release, we will need to agree on doing a release. This entails sending a message on the <a href= "http://sourceforge.net/mail/?group_id=18189">mailing list</a> asking for a vote on the release. We will use the <a href= "http://jakarta.apache.org/site/decisions.html"> Apache Jakarta system for voting</a>.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width="99%"> <tr> <td bgcolor="#525D76" class="c11"><b>Updating the Changes page</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">The <a href= "changes.html">Changes page</a> need to be up to date at any time. The goal of this page is not to described fine-grained changes in CVS like "I have corrected a typo" but rather to advertise changes that are useful to end users (for example: "Improved the Mailing-list example by ..."). As it is very hard to remember everything that everyone has done, it is mandatory to fill this page as we do the modifications and not to wait till the release to fill it.</p> </td> </tr> </table> </div> <span class="c8"><br> </span> </td> </tr> </table> </div> <br> <div class="c10"> <table cellpadding="2" cellspacing="0" border="0" width= "100%"> <tr> <td bgcolor="#525D76" class="c7"><b>Detailed administrative steps</b></td> </tr> <tr> <td> <span class="c8"><br> </span> <p class="c9">This is a detailed check list of all the steps involved to actually perform the release :</p> <blockquote> <ol> <li>Agree on a release (see above).</li> <li>Designate a release manager for the current release.</li> <li>Ensure that no one is working on any part of the files (code freeze). This is done by posting a mail on the list asking for a code freeze.</li> <li>Verify that the <a href= "todo.html">todo.xml</a> page is up to date.</li> <li>Verify that the <a href= "changes.html">changes.xml</a> page is up to date.</li> <li>Verify that the <a href= "features.html">features.xml</a> page is up to date and includes all features available in all releases + the new ones from this release.</li> <li>Verify that the news items on the <a href= "index.html">index.html</a> page are up to date (major announcement should be listed there, a release is a major announcement - A news item should be added that says which version has been released with a link pointing to the changes page).</li> <li>Perform a Ant build on the dist target (<code class="c12">ant dist</code>) on the release manager's machine to ensure everything build fine including the tests, web site generation, ...</li> <li>Tag CVS, with the name MO_<version number>_RELEASE (For example, the 0.01 release would be tagged MO_0_01_RELEASE).</li> <li>Publish the distributables files to <a href= "https://sourceforge.net/project/admin/editpackages.php?group_id=18189"> SourceForge</a>. In the release notes area of SF, put a link to the Changes page (http://mockobjects.sf.net/changes.html).</li> <li>Increase the version number indicated in the <code class="c12">build.xml</code> file by 1 (for example, after 0.01, put 0.02).</li> <li>Write a short release announcement in the news area of SourceForge (with a link to the Changes page).</li> <li>Send a message to the dev and user mailing-lists of Mock Objects to announce the availability of the release (and add a link to the Changes page).</li> <li>Send announcements to other mailing-lists (XP mailing lists on yahoogroups, JUnit mailing list) and web sites (junit.org, objectmentor, ...)</li> <li>... then relax ! ;-)</li> </ol> </blockquote> </td> </tr> </table> </div> --- NEW FILE: template.txt --- <html> <head> <meta name="generator" content="HTML Tidy, see www.w3.org"> <title>Mock Objects</title> <style type="text/css"> body '{' background-color: #ffffff; color: #000000; '}' :link '{' color: #525D76 '}' :visited '{' color: #023264 '}' :active '{' color: #023264 '}' span.c14 '{'color: #525D76; font-family: arial,helvetica,sanserif; font-size: 80%'}' div.c13 '{'text-align: right'}' code.c12 '{'font-family: courier, monospaced'}' div.c11 '{'text-align: center'}' td.c10 '{'color: #ffffff; font-family: arial,helvetica,sanserif; font-size: 100%'}' p.c9 '{'color: #000000; font-family: arial,helvetica,sanserif; text-align: justify'}' span.c8 '{'color: #000000; font-family: arial,helvetica,sanserif'}' td.c7 '{'color: #ffffff; font-family: arial,helvetica,sanserif; font-size: 119%'}' li.c6 '{'list-style: none'}' a.c5 '{'font-size: 80%'}' span.c4 '{'font-family: arial,helvetica,sanserif'}' span.c3 '{'font-size: 80%'}' span.c2 '{'color: #000000; font-size: 119%'}' span.c1 '{'font-size: 64%'}' </style> </head> <body marginheight="4" marginwidth="4" leftmargin="4" topmargin= "4"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top"><a href= "http://www... [truncated message content] |