1-------------------------------------------------------------------------------- 2 Dokuwiki Unit Test Suite 3-------------------------------------------------------------------------------- 4$Date: 2004/02/14 02:14:50 $ 5 6Credits: to the WACT team - http://www.phpwact.org, from whom the basis of 7this test suite was stolen 8 9-------------------------------------------------------------------------------- 10INSTALLING & SETUP 11 121. Grab a copy of the SimpleTest unit testing framework an extract somewhere 13 14 http://www.lastcraft.com/simple_test.php 15 or 16 http://sourceforge.net/projects/simpletest 17 182. Edit ./tests.ini 19 20 - TEST_ENABLED - set to "1" to allow the test suite to be used 21 by vistors to your site. Generally best to leave as 0 for 22 a productive site - running tests alot will hammer the server 23 Note: you will still be able to run the tests from the command 24 line even when this is set to 0 25 26 - WEB_TEST_URL - this is for running "web tests" where SimpleTest 27 acts as a web browser and executes HTTP requests against pages. 28 Should point at your Dokuwiki URL e.g. 29 30 http://localhost/dokuwiki 31 32 - PROXY - if you're behind a proxy, specify it here 33 Note: username / password are optional e.g. 34 35 http://proxyuser:proxypwd@proxy.yourdomain.com:8080 36 37 - REMOTE_TEST_URL - it's possible to run the full test suite 38 remotely (over HTTP) with some XML goodness. This should 39 point at the URL of the test suite you want to test 40 See the following URL for more info; 41 http://www.sitepoint.com/blogs/2004/06/15/simple-test-remote-testing/ 42 43 - Simple Test 44 Update the library_path to point at the directory where you installed 45 Simple Test 46 47-------------------------------------------------------------------------------- 48RUNNING THE TESTS 49 50You can run the tests in three ways. From the command line: 51 52 $ ./runtests.php -h 53 54Using a web browser; 55 56 http://localhost/dokuwiki/test/index.php 57 58As remote tests run on a remote serveri (specified in tests.ini with REMOTE_TEST_URL) and driven locally from the command line using; 59 60 $ ./remotetests.php -h 61 62 63-------------------------------------------------------------------------------- 64ADDING TESTS 65 66The test cases are kept in the './cases' directory in a directory structure 67mirroring that of the Dokuwiki's 68 69Files with the extension .group.php are group tests (collections of 70one or more seperate unit test files) - there should be one group 71test per file in Dokuwiki's real directory. 72 73Individual tests files have the extension .test.php 74 75To add tests, create a .test.php file in the correct directory under ./cases 76Probably best to use one of the existing scripts as a basis 77 78The test will not be executable via one of the test runners (see above). 79 80To add it to a group of tests, modify the corresponding .group.php file. 81 82One exception to the naming convention - files named .webtest.php and 83.webgroup.php are run using SimpleTest's browser simulator. 84 85