Hi,
Here's a call for help :) I'm wondering if there is anyone on this list
that want to help improve our unit test suite? Our code coverage report
shows that we currently are not covering much in our tests.
It's easy to get started and a great opportunity to learn the internals
of log4php and I'm sure you'll help on finding some new
bugs/improvements we haven't been able to fix yet.
*So how do you get started?*
1. Install the latest version of PHPUnit [1]
$ pear channel-discover pear.phpunit.de
$ pear install --alldeps phpunit/PHPUnit
2. Install the latest version of Xdebug [2] (if you want to create code
coverage reports)
$ pecl install xdebug
Add the following line to your php.ini for your PHP CLI:
zend_extension="/absolute/path/to/xdebug.so"
3. Checkout the latest source code
$ svn co http://svn.apache.org/repos/asf/incubator/log4php/trunk
log4php-trunk
4. Run the unit test suite
$ cd log4php-trunk/src/test/php
$ phpunit
A code coverage report is created inside target/test/report.
5. Open up target/test/report/index.html in your browser and have a look
what's covered by tests and not.
6. When you find something to test create the according
ClassNameTest.php file inside src/test/php/ (the directory layout is the
same as you see in src/main/php but using Test.php as the end of the
filename).
7. Write the test cases
- Set up a few tests and re-run the unit test suite with the phpunit-command
- Use self::markTestIncomplete(); for all incomplete test cases and have
a look on how other unit tests are written.
$ phpunit - will execute the whole test suite
$ phpunit LoggerLevelTest.php - to just test just your new tests
8. Commit
If you have commit access just go ahead and submit your new test cases
when it runs fine and cover new code.
If you don't have commit access simply do:
$ svn diff > something.patch
and hand that file over to this mailing list so one of the committers
can review and commit it.
Knut
[1] http://www.phpunit.de
[2] http://www.xdebug.org