About Me

My Photo
I am a Software Architect and Developer based in Bangalore, India. I have experience in building (scalable) applications using Java, JSP, JSF, JBoss Drools, Spring Framework, Hibernate, Ajax, JavaScript, MySQL, NoSQL (HBase, Project Voldemort). I am also a fan of Ruby on Rails, and have done some experimental work with it.

Wednesday, November 19, 2008

TDD Session

Today, I had a real TDD session while I was coding a piece for upcoming release.

I did a classical TDD (I think):
1. Wrote failing test first.
2. Coded a bit. Made the test pass.
3. Wrote another test(s).
4. Coded some more. Made the test(s) pass.
5. Left the day with a failing test.

I think, it was Kent Beck, who in his book, Test Driven Development - By Example, has mentioned that it is a good practice to leave the day with a failing test. The failing test is a good way to remember "what were you upto yesterday" when you start the day next morning.

I used Agitar JUnit runner, and it showed me code coverage done by my tests. This helped me to not only write more tests to have 100% code coverage, but also made me remove some redundant conditional checks as the those checks were evaluating to "true" always.

No comments: