TDD
During the talk on TDD (Test Driven Development) the loop of the TDD cycle was discussed. I realize some of you who have already read about this topic and are familiar with this cycle, but I just thought I would mention it.
The TDD Loop
- Write a small test for new functionality
- Write just enough code for the new functionality to pass the test
- Confirm that the revised system passes all tests
- Refactor to remove “code smells”
- Confirm that the revised system still passes all tests
So the question came up during the talk “How do you know how many tests to write?”. The answer to this question was “Write as many tests as you feel are necessary to feel confident that the code functions as it is supposed to”. Developers are very good at writing positive tests (tests that show the code does what it is supposed to), however developers need to learn to get into the mindset of writing negative tests (tests that exercise conditions that should not happen but might).
TDD is extremely useful and important. Part of the problem pointed out with adoption is that if developers are just told to write unit tests and use TDD but are never given a good explanation of “Why” it can cause resistance to moving in this direction.
No comments yet.
Leave a comment
-
Recent
-
Links
-
Archives
- August 2009 (10)
- February 2009 (1)
- January 2009 (10)
- August 2008 (2)
- March 2008 (26)
- February 2008 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS