Taking Testing Fore Granted

It feels like I've spent all my time over the past few weeks in front of JUnit and JSUnit test runners. It's true, but it's a hell of a lot better than in front of a browser doing some 'old school' iterative development.

It doesn't seem like long ago that I would manually test functionality until I believed it was solid, forget about it, and have to re-test everything manually a few months later when I wanted to change something. Did I really even re-test everything? Not usually. A change would be requested and I would do it and check it in (at least I used an RCS, eh eh?), hoping that the change I made would have no impact. This was my life for several years.

Normally I would have learned from my mistake and set up something to help me out. At work, we did finally started using Maven, which runs tests automatically on every build... but proper testing wasn't exactly in the budget, so it was kinda moot. -Dmaven.test.skip=true was pretty much hardwired into my brain. At home, I was too impatient and my interest was too fleeting. TDD was just something I'd read about in books, and nobody I knew did it. But oh how I wanted to do it.

It seems it would be hard for anyone working on any project to get into the habit of testing, without tasting the fruit of it first. It is tedious and it makes progress seem to wither away. I started Soashable almost two months ago, and am no farther along now than I was then--as far as new features. Part of it is that I rewrote the XMPP library from scratch, and created a builder for it. Another part of it is that I had finals last month. Excuses aside, I wanted to test this one.

Now I'm completely confident in the new code. Over the past several days I have swapped out the Roster GUI rendering code and made changes to the various components without worry. I simply add new test cases for new functionality, and update cases in code similar to tests that fail. No more having to memorize the whole program and rely on that for refactoring. And being that I'm working on Javascript, a dynamic language where Eclipse can't help me out, that says a lot.

And a nice side effect of being confident about my code and having great results, is I seem to not get frustrated and stop making time for the project. With high confidence, I know that the thing isn't going to crumble apart and have wasted all my energy. This leads to more net results, despite the lower (initial) throughput.

I'm sure you, dear reader, are familiar with testing. But I just thought I'd remind you of the hell you lived though before it was in your life. I am at the point now where I completely take it fore granted--I test at work (I spend more time writing tests than code) and I test at home. So while it seems like I spend my life in front of test runners, I see better results when they finally do come out; I can browse to a page full of complex code for the first time and KNOW it will work, and it does. Because I've already seen all the parts work independently. And I am confident in my code, and can not worry if I forget pieces of the system exist.

I love taking fore granted that my code works.