Tuesday, September 28, 2010

Unit- and integration tests makes our code harder to maintain

There seem to be a common misunderstanding and hype by many developers and project managers that unit- and integration tests make our code easier to maintain. In my experience this is not the case. It's just as hard, if not harder, to write good and maintainable tests as there are to write good code in general. Due to this I often see developers commenting out their tests when changing or refactoring code, as the smallest change causes too many tests to break and it just makes it unmaintainable. Does this mean that we should not write tests? No, but in the same way as we work on sharpening our skills on writing good and maintainable code, we also need to sharpen our test writing skills.