MDL_32323 improve test readme

This commit is contained in:
Petr Skoda 2012-04-10 13:03:02 +02:00
parent 95dcf96559
commit 9571db04d8

View File

@ -19,16 +19,17 @@ Installation
Test execution
--------------
* execute `phpunit` from dirroot directory
* you can also execute a single test `phpunit lib/tests/phpunit_test.php`
* or all tests in one directory `phpunit --configuration phpunit.xml lib/tests/*_test.php`
* it is possible to create custom configuration files in xml format and use `phpunit -c myconfig.xml`
* you can execute a single test case class using class name followed by path to test file `phpunit core_phpunit_basic_testcase lib/tests/phpunit_test.php`
* it is also possible to create custom configuration files in xml format and use `phpunit -c mytestsuites.xml`
How to add more tests?
----------------------
1. create `tests` directory in your plugin if does not already exist
2. add `*_test.php` files with custom class that extends `basic_testcase` or `advanced_testcase`
3. execute your new test, for example `phpunit local/mytest/tests/mytest_test.php`
1. create `tests` directory in your plugin
2. add `local/mytest/tests/my_test.php` file with `local_my_testcase` class that extends `basic_testcase` or `advanced_testcase`
3. add some test_*() methods
4. execute your new test case `phpunit local_my_testcase local/mytest/tests/my_test.php`
5. execute `admin/tool/phpunit/cli/init.sh` to get the plugin tests included in main phpunit.xml configuration file
How to convert existing tests?