…again. I have blogged about this before but it bears repeating. I am in the process of a rewrite that’s turning out pretty massive. Just now a functional test revealed something I would surely have missed.
Testing is vital these days in online application development. There’s no glacial release schedule, no rooms full of programmers to test stuff, no need to get everything perfect for a Gold Master. These days, apps are released early and they are released often. We should do everything we can to automate testing of this code.
Lucky for me Rails makes it easy. The integrated test suite is one of the best in the field.
Currently I am removing several old objects we don’t need any longer. Most of these objects were used widely, with lots of connections to existing stuff. For those unholy souls who do not have a good test suite, removing core objects can be frightening. Everything breaks and it feels you’re chasing a crushing torrent of errors. And on top of this your’re expected to release the software on time!
I am lucky enough to have a great amount of tests, covering everything from the banal to the exotic. I just ’svn removed’ the objects stone cold. Lots of errors, as you’d expect. But half an our (!) of refactoring later most of the errors were gone.
Except one. This one just kept nagging me. The weird thing was, the error appeared in a (seemingly) unrelated part of the site.
Well you guessed it. After a quick chase it turned out that these areas were not so unrelated after all. There was a dependency I surely would have missed otherwise. Were it not for the testsuite, this code would definitely have appeared in production, since I would not have thought to go there.
Functional testing of controllers: score one, bugs score zero! Booya.

Subscribe to our RSS feed


0 Responses to “A test saved my ass…”