How much testing is enough?
A question many project teams I’ve been part of couldn’t answer is how much testing we should do. Is it enough if our tests cover 80% of our lines of code? Should it be higher than that?
Line coverage is a bad metric to measure test success. Any goal other than 100% is completely meaningless because important parts of the code base might not be covered at all.6 And even at 100%, we still can’t be sure that every bug has been squashed.
6 Test coverage: if you want to read more about 100% test coverage, have a look at my article with the tongue-in-cheek title Why you should enforce 100% code coverage at https://reflectoring.io/100-percent-test-coverage/.
I suggest measuring test success by how comfortable we feel shipping the software. If we trust the tests enough to ship after having executed them, we’re good. The more often we ship, the more trust we have in our tests. If we only ship twice a year, no one will...