Some software developers like testing, others try to avoid it. I use it since the year 2000 in different ways. Test Driven Development seems to work best for me. It gives me a clear goal and I know when I finished a peace of softeware. But I often encounter discussions at work where developers use testing as a currency and try to bargain with the product owner: "If you want to have the feature by the end of next week I can only have 20% test coverage."
I see high test coverage as an integral part of good software and not something optional. So I decided to take it to the next level. Is it possible to have 100% test coverage all the time.
Definition
We need some definitions first. What do I mean when I use the words "test" and "coverage" and "all the time" and "100%"?
Software can be tested with unit tests, integration tests and some other forms of tests. It turned out that the best way for my project is a mixture of unit tests and system test. Then I tried to cover every requirement and every line of code with at least one test. This is my definition of 100%. And I am not allowed to commit my changes until I reached my desired test coverage.
Select a project
- Not too small - it should need to take a couple of days or weeks to implement to see if my goal can be kept over time.
- Not too large - it should not be discouragingly complex for one programmer.
- A real world problem - it should not be too abstract or overly theoretical to prove that the goal can be achieved in my everyday work.
- Well-defined - I do not want to spend much time on requirements engineering.