You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by Knut Urdalen <kn...@php.no> on 2009/04/30 15:02:11 UTC
Call for help: Improving our unit test suite
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
Re: Call for help: Improving our unit test suite
Posted by Christian Grobmeier <gr...@gmail.com>.
> Hey, we have a wiki actually: http://wiki.apache.org/logging/Log4PHP
Thanks, I will include this in our site, since there is no indicator
to this place there.
Cheers
Re: Call for help: Improving our unit test suite
Posted by Knut Urdalen <kn...@php.no>.
Christian Grobmeier wrote:
> thanks anyway for the tutorial. I suggest that we store this in a
> test-readme since we have no wiki yet.
>
Hey, we have a wiki actually: http://wiki.apache.org/logging/Log4PHP
I used it for writing the "Proposal to get log4php into the incubation
again" [1] June 2007.
Feel free to create new pages and document things like this.
Knut
[1] http://wiki.apache.org/logging/Log4PHP/Proposal
Re: Call for help: Improving our unit test suite
Posted by Christian Grobmeier <gr...@gmail.com>.
I see. Will compile PHP myself then, but this will need a while...
thanks anyway for the tutorial. I suggest that we store this in a
test-readme since we have no wiki yet.
Cheers
On Thu, Apr 30, 2009 at 10:34 PM, Knut Urdalen <kn...@php.no> wrote:
> Christian Grobmeier wrote:
>
> wanted to install xdebug on OSX 10.4 and 10.5. It fails with syntax
> errors. I am assuming it happens cause i use MAMP :-) Can you tell
> what enviroment are you using? Selfcompiled PHP i guess?
>
>
> You need to compile Xdebug on Mac (binaries are only available for Windows)
> and in order to do that you need to have necessary tools and header files
> installed.
>
> The basic requirements for compiling PHP extensions is the same as for PHP
> itself (see: http://www.php.net/anoncvs.php)
>
> I prefer MacPorts [1] as my package manager on OS X since that's the easiest
> way to get all needed tools and header files. There's too many tutorials on
> this [2] so I won't go into details. But at least you will have to do this:
>
> $ sudo port install php5 +apache2 +mysql5 +pear
> $ sudo port install php5-devel
>
> Some of the basic tools like gcc etc is installed with Xcode, but most of
> what you need is also available in MacPorts.
>
> Knut
>
> [1] http://www.macports.org
> [2] http://2tbsp.com/content/install_apache_2_and_php_5_macports
>
>
Re: Call for help: Improving our unit test suite
Posted by Knut Urdalen <kn...@php.no>.
Christian Grobmeier wrote:
> wanted to install xdebug on OSX 10.4 and 10.5. It fails with syntax
> errors. I am assuming it happens cause i use MAMP :-) Can you tell
> what enviroment are you using? Selfcompiled PHP i guess?
>
You need to compile Xdebug on Mac (binaries are only available for
Windows) and in order to do that you need to have necessary tools and
header files installed.
The basic requirements for compiling PHP extensions is the same as for
PHP itself (see: http://www.php.net/anoncvs.php)
I prefer MacPorts [1] as my package manager on OS X since that's the
easiest way to get all needed tools and header files. There's too many
tutorials on this [2] so I won't go into details. But at least you will
have to do this:
$ sudo port install php5 +apache2 +mysql5 +pear
$ sudo port install php5-devel
Some of the basic tools like gcc etc is installed with Xcode, but most
of what you need is also available in MacPorts.
Knut
[1] http://www.macports.org
[2] http://2tbsp.com/content/install_apache_2_and_php_5_macports
Re: Call for help: Improving our unit test suite
Posted by Christian Grobmeier <gr...@gmail.com>.
Hi
> $ pear channel-discover pear.phpunit.de
> $ pear install --alldeps phpunit/PHPUnit
this wasn't available on my side - but installing it manually wasn't a problem.
> 2. Install the latest version of Xdebug [2] (if you want to create code
> coverage reports)
>
> $ pecl install xdebug
>
wanted to install xdebug on OSX 10.4 and 10.5. It fails with syntax
errors. I am assuming it happens cause i use MAMP :-) Can you tell
what enviroment are you using? Selfcompiled PHP i guess?
Christian