« Home | Changing Mindset » | Business Knowledge and Software Projects » | Reading Styles » | Java and Access Specifiers » | Why refactoring helps? » | No New Year Resolutions for Me » | Learning Tips » | IIM CAT 2004 - The wounded lion roars back » | Personality Types » | Is Xtreme Programming the next Strategic Inflectio... »

Automated Tests are Great

I was asked to write this utility to convert a graph of objects of type 'X' into type 'Y'. The difference between X and Y is that X objects sit in a layer whereas Y travel all over the network.

I was already handed out some partly written code. I was happy because I am training myself to be an agile practitioner and reading, working on someone else's code should be easy for me. The hitch here was the part functionality wasnt complete and it wasnt backed up by any tests.

I first wrote the part functionality. Then I wrote a junit test to verify it. THen i added few more test methods which made this part functioality a solid one. Next I moved to write the other test cases/methods and completing the whole utility. The utility used Reflection API. THe key to usage of this utility was people would have to genreate X and Y objects and have not irritating get/set methods to do the conversion.

The user of this utility reported me one bug. Immediately I recreated that in junit and went on to fix it. And it was real quick.

Now If you ask me how otherwise without junit I would have handled this surprisingly I dont know. Through some irrelevant uncomfortable system outs and lots of doubt, I believe.

Hats off to Agile.

Links to this post

Create a Link