18 junho, 2009

Unit testing is changing my life

For a while now i have been hearing good things about unit testing and TDD, but every time i stopped to think about doing that i always felt that i was wasting my time, and in face of the first difficult i just abandoned the whole thing. I was wrong, very, very wrong.

In the later days after reading some parts of the book pojos in action, and the aproach of the author in the test part of the application design, and restarted to try and see if the test practice would make any difference at all, and man was i stunned by the result.

I have been using spring for a while now only for the transaction facilities of the framework, but now im really seeing how much the framework ease the process of testing and how much time testing saves. When i stop to think about unit test the classes i develop, in the short range it consumes more time to finish a functionality, however in the middle range it saves a lot of time because you can have a fast feedback of the changes made in the class, this is specially good with web applications because spring allows you to test the methods without starting the web container and with struts 2 the actions are even easier to test than the first version.

Now, when im starting a new method i think in how to test only this functionality and this is showing to be a very good thing because you can concetrate on the small parts of the code and break the complexity of the whole process.

This combo of struts2+spring+junit is really making me enjoy developing again.