Fork me on GitHub

Thursday, May 8, 2008

Renewed thougths about DRY in Testing

This is in reference to my previous post on DRY and Testing. In that I made a point that DRY as a principle which must be upheld not only for development but also for testing. But there is something special about testing especially tests which distinguish them from development code. Tests are actually examples which everybody uses as guide lines for development. They are executable specification and help people to understand the software. So being used as examples demand expressibility and ease of understandability.

DRY can make code terse and compact for maintenance but when it comes to test code we must compromise some of it for understandability. This I realized when I remembered that tests are not only code but also serve as examples. Brian Marick has an interesting post in this subject in his blog.

I think this is something important I learned. But it is also necessary to keep the balance between the not letting repetition in code and helping tests be as examples.

No comments: