Unit testing is a powerful and proven method to improve and maintain the quality of any body of code. Many developers take a look at unit testing and conclude that while it may be a good thing to have a test suite, most of the time it's probably not worth the effort to write the tests. That's the way I felt too, until I was working on a complex module that was almost impossible to test without some sort of automation. I quickly realized that even for simple classes, writing good unit tests wound up saving the time spent writing tests tens, sometimes hundreds of times over!
In the 1.5 development cycle, unit testing came to the party rather late. After a false start and inactivity, the team decided to restart the effort, using PHPUnit as the testing framework. By the time we got a good idea of how to best approach unit testing, 1.5.0 was already set for release.
As a result, unit tests for 1.5 have mostly been written to verify specific problems and the changes made to fix them. This is good, but we can do a lot better. For 1.6, that's exactly what we plan to do. We may not see unit tests covering 100% of the code base by the time 1.6 is released, but our goal is to see significant coverage by then. Personally, I'd like to see coverage of at least 60%, the higher the better.
The objective of the new "Joomla!" unit test facility is to make it as easy as possible to write test code. So far a few developers have "test driven" the facility and come to the same conclusion -- that writing tests decreases development time overall.
But there is still a lot to do. Not only do we need to move quickly to 100% test coverage, but there are many improvements that can be made to make it easier to run tests, and to leaverage the many advanced features of PHPUnit.
For more information on unit testing in "Joomla!", see https://docs.joomla.org/Unit_Testing on the documentation wiki.
Unit Testing in 1.6
- Details