We’ve used test-driven development from the beginning of Caucho, almost 12 years now, and it heavily influences our development, refactoring, and also our release cycle. Today, we’re in the final two weeks of the release cycle for 4.0.1 which means passing our regression test suite and working through load testing.
Each week in our release cycle is influenced by our TDD methodology. For Resin, we aim for an eight week release cycle, and usually slip a week or two so it ends up being ten-ish weeks.
The first two weeks are for any major refactoring, i.e. anything that will massively break the regressions. Resin 4.0.1 includes a major refactor of CanDI (JSR-299) based on changes in that specification, and also our first full implementation of the Servlet 3.0 draft. Because those changes were so large, and because we use CanDI for all our configuration, the changes broke essentially all of our tests: our ioc/candi tests, the core Resin server tests, some JSP tests, our EJB tests, and even our JPA (amber) tests. Last week, for example, we failed about 3000 tests.
The next four weeks of the release cycle are for bugs and any new features. All bugs and new features get new tests added. In some rare cases like the CanDI refactor, the refactoring might slip into this phase. But normally, we stop breaking tests and start passing new ones.
The final phase of the release is passing all our regressions, and working on our stress tests. This is the phase we’re in now. From an outside view, this phase can look like we’re not doing much, because we’re not adding features, and we’re generally not fixing bugs, and generally don’t have time for blog posting. Nevertheless, this phase is our most important. For releases like 4.0.1 which involve large refactoring, the regression cleanup can take extra time.
People who have used TDD know that its main value is giving the flexibility to refactor your code. The quality from the tests is important, of course, but the extra freedom to continually refactor and continually improve the code base is extremely valuable.