Warning! This page has the following tags:
- This page is not necessarily deprecated, but may need to be updated.
- This page needs to be merged with docbook documentation.
UnitTests
If you are not familiar with UnitTests, a unit test is code written to verify expected behavior of a particular piece of code, say a particular method or function. Writing the test before you even write the actual code you are attempting to test has many benefits.
- Tests read like comments, telling you exactly how the code should behave.
- Tests give you confidence and encourage change, knowing things still work when changes are made.
- Tests provide instant insight on how changes affect the rest of the system
- Writing the code, after the test encourages you to do the simplest thing that could possibly work helping you to avoid cruft
Further reading:
- Jason Sweat's excellent presentation of TDD from phpTropics '05
- Wikipedia page on Test Driven Development
- phpPatterns article
- simpletest arcile
- SimpleTest docs
- See also UnitTested?
- TODO: quick tutorial on TDD (see #22)

