DEV Community

Discussion on: How much code coverage is enough?

Collapse
 
webreaper profile image
Mark Otway

Don't concentrate on coverage numbers. If your most complex, fragile and/or critical code path is covered with multiple good quality tests that's way better than if you've spent days eeking out some extra coverage for all your getters and setters and generated code.

What you're looking for with test coverage isn't a number, or completeness, it's a confidence to change stuff and know that if you break something, your tests will flag it up to you. So test stuff that matters and that is likely to be impacted by future changes.

I've got projects with 50% coverage that are tested awesomely and give huge confidence and change agility. I've also seen projects with > 90% coverage that break every release because most of the tests are worthless.