SimpleTest vs PHPunit
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.
which unit-test framework for PHP: simpletest, phpunit or?
I don't think either is going away anytime soon. Simpletest is maintained by a small, but involved group of people.
PHPUnit seems to have a bigger userbase, which may count as an argument for switching. I'm quite happy with Simpletest though.
NetBeans : phpUNit or SimpleTest?
For my general take on PHPUnit vs SimpleTest please see this question:
What unit testing in php to start
.
To sum that post up:
- PHPUnit is THE deFacto standard for Unit testing in PHP
- Simpletest is outdated and has (imho) outlifed it's usefulness.
For Netbeans:
Netbeans as great PHPUnit Support
and I've never seen or heard of anything like that for SimpleTest. I'm not even sure it can run tests written with SimpleTest at all. (At least i couldn't find anything)
So my clear recommendation is to got with phpunit as there are only upsides.
phpUnit: Upgrade test cases from simpleTest to phpUnit
This script should do most of the job.
You may also find useful information about migrating from simpleTest to PHPUnit here.
But you certainly will have to fix a few things by hand. Good luck!
PHPUnit and SimpleTest on Apache and Nusphere PhpED
We migrated from SimpleTest to PHPUnit a little over a year ago and have been very happy. SimpleTest is abandoned while PHPUnit is actively developed with regular releases and a plan for the future. We run PHPUnit on Ubuntu and Windows machines both from the command line and in NetBeans IDE even though our application is a CMS running behind Apache.
For continuous integration, check out Templates for Jenkins Jobs for PHP Projects. It has integration of PHPUnit for testing as well as PHPMD, PHPCPD, PHP Depend, PHPLOC, and PHP CodeSniffer.
I can't completely answer your original question regarding running PHPUnit in a web debugger. You could install PHPUnit using PEAR and check out the script that runs it. It's all PHP except for the initial shell script, but with a little work you could write a similar script in PHP that sets up your environment and calls an appropriate TestRunner
.
Related Topics
In PHP, How to Check If a Function Exists
How to Get the Last N Items in a PHP Array as Another Array
How to Get the Value of a Private Property with Reflection
%2F in Url Breaks and Does Not Reference to the .PHP File Required
How to Handle Diacritics (Accents) When Rewriting 'Pretty Urls'
PHP Strtotime +1 Month Behaviour
How to Calculate Time Difference in PHP
PHP Regex to Get String Inside Href Tag
Belongstomany Relationship in Laravel Across Multiple Databases
Error 1148 MySQL the Used Command Is Not Allowed with This MySQL Version
Algorithm for Generating a Random Number
Retrieve (Or Simulate) Full Query from Pdo Prepared Statement
PHP MySQL Greek Letters Showing Like? Marks
How to Call a PHP Function from Ajax