What unit testing in PHP to start [duplicate] What unit testing in PHP to start [duplicate] php php

What unit testing in PHP to start [duplicate]


I'm really really baffled that Simpletest still is considered an alternative to phpunit. Maybe i'm just misinformed but as far as I've seen:

  • PHPUnit is the standard; most frameworks use it (like Zend Framework, Cake, Agavi, even Symfony is dropping their own Framework in Symfony 2 for phpunit).
  • PHPUnit is integrated in every PHP IDE (Eclipse, Netbeans, Zend Stuide, PHPStorm) and works nicely.
    • Simpletest has an eclipse extension for PHP 5.1 (a.k.a. so old that it's on sourceforge) and nothing else.
  • PHPUnit works fine with every continious integration server since it outputs all standard log files for code coverage and test reports.
    • Simpletest does not. While this is not a big problem to start with it will bite you big time once you stop "just testing" and start developing software (Yes that statement is provocative :) Don't take it too seriously).
  • PHPUnit is activly mainted, stable and works great for every codebase, every scenario and every way you want to write your tests.
    • Simpletest is unmaintained, outdated and does not work well with PHP 5.3 (released over a year ago)
  • (Subjective) PHPUnit provides much nicer code coverage reports than Simpletest
    • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)

I've yet to see any argument in favor of Simpletest. It's not even simpler to install since PHPUnit is available via pear:

pear channel-discover pear.phpunit.depear install phpunit/PHPUnit

and the "first test" looks pretty much the same.

For everything you want to test PHPUnit will have a solution and you will be able to find help pretty much anywhere (SO, #phpunit irc channel on freenode, pretty much every php developer ;) )

Please correct me if i've stated something wrong or forgot something :)


I started with SimpleTest because the learning curve didn't seem as steep. But it's not maintained, and brings up loads of warnings in PHP5.3, as well as not being able to do everything I wanted. I eventually had to switch to PHPUnit, which was a long process converting my tests. If only I'd started with PHPUnit in the first place!


SimpleTest is slightly easier to grasp, but PHPUnit is the best ( in my opinion at least ) , so if you want to start learning and using a framework, start with the one you're going to use when you'll be a master in TDD. Don't look at if it's easier or harder now , because if you start with SimpleTest for example , then you start using Zend Framework because your boss tells you so , you'll have to use PHPUnit with ZF. So think of your future , because an easy to learn framework doesn't necessarily have to be the best one , usualy the harder to grasp the better the framework .

Also have a look at their revisions , see which one is maintained better .