While writing unit tests software engineers tend to relook at the source code and improve it so that it becomes testable. This is an internal experience. When you do this your code becomes maintainable as well. Have you gone through this experience?
You get this experience when you write unit tests for the complex pieces of your source code.
Two recent articles on topics related to this subject are ‘Breaking Away From The Unit Test Group Think’ by Cedric Beust and ‘Chasing Code-Coverage Baubles’ by Andrew Binstock. A good read for all software engineers.
These articles reveal several misconceptions related to Unit Testing and TDD and provide answers to the following questions.
- Do you think 90% code coverage through unit testing is sufficient?
- Do you think you need to do TDD always in your development cycle?
- What is the optimal code coverage? How do you decide?
- Has TDD become a common practice in the industry?