Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was wondering if anyone that has experience in both this stuff can shed some light on the significant difference between the two if any?

Any specific strength of each that makes it suitable for any specific case?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
260 views
Welcome To Ask or Share your Answers For Others

1 Answer

This question is quite dated but as it is still getting traffic and answers I though I state my point here again even so I already did it on some other (newer) questions.

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 (1&2), 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. old) and nothing else.
  • PHPUnit works fine with every continuous 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 actively maintained, stable and works great for every codebase, every scenario and every way you want to write your tests.
  • (Subjective) PHPUnit provides much nicer code coverage reports than Simpletest
  • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)
  • Also there are a couple of suggestings for a web interface to phpunit tests.

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.

As of PHPUnit 3.7 it's even easier to install it by just using the PHAR Archive

wget http://pear.phpunit.de/get/phpunit.phar
chmod +x phpunit-3.7.6.phar

or for windows just downloading the phar and running:

php phpunit-.phar

or when using the supported composer install ways like

"require-dev": {
    "phpunit/phpunit": "3.7.*"
}

to your composer.json.


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 :)

Overview of PHP Testing tools

Video: http://conference.phpnw.org.uk/phpnw11/schedule/sebastian-bergmann/

Slides: http://www.slideshare.net/sebastian_bergmann/the-php-testers-toolbox-osi-days-2011

It mentions stuff like Atoum which calls its self: "A simple, modern and intuitive unit testing framework for PHP!"


Full disclosure

I've originally written this answer Jan. 2011 where I had no affiliation with any PHP Testing project. Since then I became a contributor to PHPUnit.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...