unit testing for PHP

At some moment, I found that I’m afraid of writing new code. The reason was simple. I wrote in PHP and, obviously, without unit testing. I got the programmer’s block as punishment. To overcome the block, I had to create tests first.

As usual, the first thing I made, was searching Usenet. And I’m astomished by the result. The search for “unit testing” in the group “comp.lang.php” generates on four (4!) pages! PHP developers suck!

Well, I switched to usual Google and found few resources:

PHP unit testing tutorial – Creating an example test case in PHP
The first link I got.

PHP unit testing tools (7 found)
The complete list of PHP unit testing frameworks.

Unit testing in PHP.
Thread in comp.lang.php, with critique of phpunit, PHPUnit and PHPUnit2.

I didn’t have time to investigate all the frameworks in the details. Therefore, impressed by the good documentation, I chose SimpleTest (don’t be misguided by the name, it’s actually full-featured).

I’ve written the tests for my application, and I’m glad with this framework. Thank you, Marcus Baker, for SimpleTest.

Leave a Reply