Wednesday, August 29, 2012

Test Driven Development - using Eclipse

TDD is getting very important these days due to some of its benefits that most of the bugs are found at the development stage. Unit tests are already in place which gives you a better code coverage, more confident code and more importantly you always know that the addition of behaviour has not broken your previous code. Apart from that there are other benefits like you may end up getting a better design than you originally thought. It will also help in using a lot of patterns in your code, which may not be visible at the start.

I was going through some videos here, that explains how to use TDD in Java Development in Eclipse. The instructor has actually broken it down nicely and try to convince you of all the above points.

I liked some of his principle or things to remember, which are:
  • We are only doing one activity at a time
  • We can be doing any one activity of the four
    • Writing Test
    • Writing Production Code
    • Refactoring / updating / Cleaning Test code
    • Refactoring / updating / cleaning production code
  • We are only going to write production code when we have a failing test
  • When we add a test, earlier written test should not fail