Monday, June 2, 2008

I love automated unit tests

Did I mention that I am a big fan of automated unit tests?

As we develop Timeless Time & Expense 3.0, we are anticipating many things we would like to do. Some of these will not be available on 3.0 release date. Some are not even definate, but we are preparing for them now. One such item is a hosted version of Timeless Time & Expense.

Unfortunately, we put this off a little too long. We really should have done it months ago, but somehow other 3.0 development took priority. The key to a hosted version is running many organizations in the same database. This means adding another key field on nearly 60 tables. Were it only that simple......

Adding a new key field means a change to every foreign key and every data access call. Even that isn't so bad. The real problem is testing it. That is where a suite of automated unit tests help a ton. When developing the original web version, we created automated unit tests for all database and business logic. During the 3.0 development we expanded the tests for all new functionality. So even though we started this a little late in the project, it only took a week and a half to implement and test. Without already established unit test, this would likely have set the project back months.

An additional challenge was making sure the new logic really did only access one organization. After all, when your application only works with one organization at a time, how could your be sure it wasn't crossing the line somewhere? In new development, this wouldn't be such a concern. But when the change is to an established application it is a scary and daunting prospect.

Again, automated unit tests come to the rescue. With unit tests, we can simulate things that would take months to test through the UI. Only the last half week was spent adding the new unit tests. With that small time investment, we can be confident we can deliver a hosted version plus be ready for the next big change.

Labels: , , ,