< Code Convention

Code Documentation >

7. Unit Tests

7.1. Introduction

Unit tests are an important componant in the CartoWeb development environment. The framework used for unit testing is based on PHPUnit2, a PEAR package. For more informations abouth PHPUnit2, see http://pear.php.net/reference/PHPUnit2-2.0.3/

PHPUnit2 is included in the libraries shipped with CartoWeb. Thus, no installation is needed to run and write new tests.

7.2. Writing Tests

Information about writing tests for CartoWeb can be separated into two parts. First part about writing Unit tests in general, useful for people new to PhpUnit. Then a part more specific about the infrastructure which is available in CartoWeb for writing tests.

7.2.1. General Information About Writing Tests

Test cases are located in directory tests for testing the core of CartoWeb and in the directories <project>/tests for for tests specific to project <project>. Inside these tests directories, path hierarchy mirrors the existing hierarchy they are testing. For instance, the tests hierarchy for the core CartoWeb testing is the following:

<pre class="s