So, today I’m going to post my first Test Driven Development update. This week it just so happens that I decided to add a feature to one of the apps at work that I maintain that also lends itself well to standalone testing. Basically, there’s some information that’s currently split up between several property files and being hard coded in JSPs or classes themselves. Yuck. So I decided to move it all into one XML file to consolidate it. This should make the application easier to maintain and provide more scalability for the future when we have bunches of records instead of just the two that were there until this week. I had to jump through some hoops to get the infrastructure set up to use the XML file, but that’s another entry.
Anyway, the task of reading the XML file and turning it into beans is the perfect job for unit testing. Before I write any code that uses my beans, I can populate them and make sure they work using unit tests. So far, so good. By writing an ultra-simple test harness, I’ve been able to work out all the bugs and difficulties involved with getting the libraries I’m using set up properly, putting the XML file where it needs to be, getting my build working right, and populating the beans using the data in the XML file very rapidly thanks to being able to run the unit tests as I develop. I think it has saved time so far.