Including testing in the software development process is proven to reduce hours by 15-35% as well as improve code defects by 65-90%. So testing is good.
“We should have every line of code covered by tests.”
Fact is that covering every line is not likely to make a difference. Research shows that coverage doesn’t indicate how effective tests are at surfacing defects:
“Our results suggest that coverage, while useful for identifying under-tested parts of a program, should not be used as a quality target because it is not a good indicator of test suite effectiveness.” — Coverage Is Not Strongly Correlated with Test Suite Effectiveness
What should you test? It turns out you need to test smarter, not harder. Here’s what you should test:
- The important parts of your app that users interact with the most.
- Code that contains important logic. For example, code that calculates a fee or markup that could cost your company money if it isn’t exactly correct.
- Code that is called often.
- Code that can make the whole application fail.