I am really new to this TDD – Test Driven Development. One of the forum admin in PHPUGPH is advocating in TDD. I got a PowePoint Presentation file from his blog:
Test Driven Development is not about software testing. It is about software development and testing is just the side effect of it. According to those TDD masters:
If a code is worth writing, it is worth testing. If it is not worth writing, why would you even bother?
It also says that in TDD, before a code is ever written into your application, it is tested first. Before a class is written, before its methos are written, it is tested already. It may be stupid to write a test case when a class still does not exists, but that is how TDD goes.
You test for a class. If it does not exists, then create it. Then test again. It you test for a methd, it fails. Then you create it. You usually first see a red bar (FAILURE) then correct it to make it green.
For PHP, I am going to use SimpleTest rather than PHPUnit. I’ll have to blog about it later.