test.doxy
1 /*!
2 \page tests Tests
3 <div class="has-toc"></div>
4 
5 # Testing # {#testing}
6 
7 The tests shipping with wCMF are based on [PHPUnit](https://phpunit.de/). They
8 are located in the _src/wcmf/test_ directory.
9 
10 ## Running tests ## {#testing_run}
11 
12 Before running the tests the code generator is used to generate the environment:
13 
14 <div class="shell">
15 ```
16 $ cd src/wcmf/test/model & ant
17 ```
18 </div>
19 
20 To run all tests, execute the following command in the _src/wcmf/test_ directory:
21 
22 <div class="shell">
23 ```
24 $ phpunit --bootstrap bootstrap.php --configuration configuration.xml
25 ```
26 </div>
27 
28 The tests use PHP's built-in web server where necessary and operate on a file
29 based database ([SQLite](https://www.sqlite.org/)).
30 
31 ## Writing tests ## {#testing_write}
32 
33 To simplify setting up the testing enviroment, wCMF provides the
34 \link wcmf::lib::util::TestUtil `TestUtil`\endlink class. It has methods for
35 starting the test server, initializing the framework, starting sessions and
36 simulating requests.
37 
38 For developing custom test cases, the following base classes are provided:
39 
40 - \link wcmf::test::lib::BaseTestCase `BaseTestCase`\endlink is used as
41  base class for all test cases. It initializes the framework before each test.
42 - \link wcmf::test::lib::DatabaseTestCase `DatabaseTestCase`\endlink adds
43  database support for testing persistency related functionality.
44 - \link wcmf::test::lib::ControllerTestCase `ControllerTestCase`\endlink
45  adds a convenience method for running requests.
46 - \link wcmf::test::lib::SeleniumTestCase `SeleniumTestCase`\endlink is used to
47  run tests with [Selenium](http://www.seleniumhq.org/).
48 */