<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 'http://www.w3.org/TR/html4/loose.dtd"'>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Automated Testing</title><link rel="stylesheet" type="text/css" href="openacs.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="OpenACS Core Documentation"><link rel="up" href="eng-standards.html" title="Chapter 12. Engineering Standards"><link rel="previous" href="variables.html" title="Variables"><link rel="next" href="doc-standards.html" title="Chapter 13. Documentation Standards"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><a href="http://openacs.org"><img src="/doc/images/alex.jpg" style="border:0" alt="Alex logo"></a><table width="100%" summary="Navigation header" border="0"><tr><td width="20%" align="left"><a accesskey="p" href="variables.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Engineering Standards</th><td width="20%" align="right"> <a accesskey="n" href="doc-standards.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Automated Testing"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="automated-testing-best-practices"></a>Automated Testing</h2></div></div></div><div class="authorblurb"><p>By <a class="ulink" href="mailto:davis@xarg.net" target="_top">Jeff Davis</a></p>
          OpenACS docs are written by the named authors, and may be edited
          by OpenACS documentation staff.
        </div><p>Best practices in writing OpenACS automated tests</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p title="Special characters in Tcl"><b>Special characters in Tcl. </b>
Try strings starting with a <code class="computeroutput">-Bad</code> and strings containing <code class="computeroutput">[BAD]</code>, <code class="computeroutput">{</code>, <code class="computeroutput">\077</code>, and <code class="computeroutput">$Bad</code>.  For user input, <code class="computeroutput">[BAD]</code> should never be evaluated, <code class="computeroutput">\077</code> should not be turned into a <code class="computeroutput">?</code> and <code class="computeroutput">$Bad</code> should not be interpolated.  The string <code class="computeroutput">-Bad [BAD] \077 { $Bad</code> should be valid user input, should pass through the system unaltered, and if it isn't that's a bug.
</p></li><li class="listitem"><p title="Quoting issues"><b>Quoting issues. </b>Put some html in plain text fields and make sure the result is
properly quoted anywhere it shows up (I use "&lt;b&gt;bold&lt;/b&gt;"
usually).  Look out especially for quoting errors in the context bar
and in round trips via an edit form. For fields that disallow html
tags you can use <code class="computeroutput">&amp;amp;</code> to check that the field is quoted
properly.  If it is not displayed as <code class="computeroutput">&amp;amp;</code> then the quoting for the field is incorrect. (It's not clear whether this
should be considered an error but given that data for text fields can
come from various sources if it's text it should be properly quoted
and we should not rely on input validation to prevent XSS security
holes.)</p></li><li class="listitem"><p title="Whitespace input"><b>Whitespace input. </b>Check that whitespace is not considered valid input for a field
if it does not make sense.  For example, the subject of a forum post is
used to construct a link and if it is " " it will have a link of
<code class="computeroutput">&lt;a href="..."&gt; &lt;/a&gt;</code> which would not be clickable if whitespace was allowed as a valid input.
</p></li><li class="listitem"><p title="Doubleclick"><b>Doubleclick. </b>
Make sure that if you submit a form, use the back button, and submit
again that the behavior is reasonable (correct behavior depends on
what the form is for, but a server error is not reasonable).
</p></li><li class="listitem"><p title="Duplicate names"><b>Duplicate names. </b>
Make sure that if a duplicate name is entered that there is a
reasonable error rather than a server error.  Check for
insert, move, copy, and rename.
</p></li></ul></div><div class="cvstag">($Id: automated-testing-best-practices.html,v 1.24.2.3 2010/12/12 01:37:24 ryang Exp $)</div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="variables.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="doc-standards.html">Next</a></td></tr><tr><td width="40%" align="left">Variables </td><td width="20%" align="center"><a accesskey="u" href="eng-standards.html">Up</a></td><td width="40%" align="right"> Chapter 13. Documentation Standards</td></tr></table><hr><address><a href="mailto:docs@openacs.org">docs@openacs.org</a></address></div><a name="comments"></a><center><a href="http://openacs.org/doc/current/automated-testing-best-practices.html#comments">View comments on this page at openacs.org</a></center></body></html>