tedious tdd

Published 03-08-2006 11:39 PM | jokiz

i've been reading a number of samples of tdd including the bookmarkcollection sample of james newkirk in his blog here (http://blogs.msdn.com/jamesnewkirk/archive/category/5458.aspx).

some samples i've read tests for the value of the property after setting it.  although i agree that i might add additional implementation on the mutator of the properties or attach some rollback changes on the OnPropertyChanged handler depending on some rules later on the development, do we really have to add these redundant simple tests?

james newkirk has this series of tests for the bookmarkcollection, check count increment after adding, etc.  i know that these simple tests will be important in the long run but can we just automate the creation of these kind of simple tests.  i've read that one can use codesmith (which used to be free) for this kind of stuff but i want to know how you guys are doing it?

Filed under: , ,

Comments

# cruizer said on March 9, 2006 4:04 PM:

ah, according to Kent Beck the power of test-driven development is that it gives you the confidence to take teensy-weensy steps (e.g. that set property test you discussed above) and big steps (e.g. test a big/crucial method). so it really depends on you.

in my case i'd rather not take the teensy-weensy steps if i'm pretty sure of what i'm doing. besides, the tests in the big steps are likely to fail if simple property set/get are not working OK. that's why it's crucial to have comprehensive tests in the big/crucial methods. you shouldn't be contented with like one or three test cases just for it. i think a code coverage solution (like NCover) can help you find out if your tests are actually exercising only a small portion of your code (bad) or a large portion of it (good/better).

:)

# jokiz said on March 9, 2006 5:46 PM:

thanks andre for the feedback.

i think i'll try to look for automated generation of those teensy-weensy steps (so far i've seen codesmith templates that uses reflection) to complement those crux tests.

thanks also for the NCover tip.