8

Possible Duplicate:
Simple test vs PHPunit

I'm new to good practices on software development. I need to know with witch testing unit framework should I use. I have see that some people use PHPUnit and others use SimpleTest. What package should I choose for a beginner?

Best Regards,

5
  • 2
    The only objective decision help I can offer is that PHPUnit is the de-facto standard in UnitTesting.
    – Gordon
    Commented Jan 7, 2011 at 10:05
  • @Gordon, not sure I would go so far as to say "de facto standard". Simpletest is still pretty well used even though development has stalled.
    – Nathan
    Commented Jan 7, 2011 at 11:04
  • 2
    @Nathan by whom I wonder? I never see any speakers advocating SimpleTest when I attend conferences. But there is always people showing how to do things with PHPUnit.
    – Gordon
    Commented Jan 7, 2011 at 11:14
  • @Gordon, well maybe you are right. I just seem to remember coming across as many projects using SimpleTest as PHPUnit.
    – Nathan
    Commented Jan 7, 2011 at 12:03
  • Did you get a sufficient answer or is there anything you want to have added ?
    – edorian
    Commented Feb 16, 2011 at 16:06

5 Answers 5

25

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.de
pear 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 :)

3
  • 2
    I agree, very good. I think what appeals is that it does just look simpler to someone who is starting out in PHP unit testing. And it is simpler to install if you aren't using PEAR (which, believe it or not, some people don't): You just download a zip and open it.
    – Nathan
    Commented Jan 7, 2011 at 16:34
  • @Nathan: Agreed, if you don't use the pear installer (we don't do that at work e.g.) phpunit can really be a major pita to get running if you don't know what too look for :). Especially since 3.5
    – edorian
    Commented Jan 10, 2011 at 8:24
  • Answer could use some updating, phpunit doesn't use pear any more, the code coverage links don't work, etc.
    – Kzqai
    Commented Jul 23, 2014 at 13:28
5

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!

1
  • And I'm still not convinced my test coverage is 100% with PHPUnit, whereas if I'd used TDD with PHPUnit from the start it would be.
    – Nathan
    Commented Jan 7, 2011 at 12:06
2

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 .

0

I found SimpleTest easy to start, and usable for my purposes. No big issues found as for now. The manual/website is a bit confusing, but with some example-searching it's enough.

Does not feel very professional, but as you're asking for beginner framework, by all means, try that one :)

0

Here's a good read... This uses SimpleTest and to start with this is better than PHPUnit...

Newbie's Guide to Unit testing

2
  • Actually, no. It teases at PHPUnit and then runs through SimpleTest as it's "a much easier testing framework".
    – Adam
    Commented Jan 7, 2011 at 10:04
  • Yep.. I meant It uses "SimpleTest" :) Commented Jan 7, 2011 at 10:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.