DEV Community

Discussion on: How much code coverage is enough?

Collapse
 
quii profile image
Chris James

I would look at it at a different angle

Are you getting lots of defects?

Then your testing strategy probably isn't good enough.

Do you feel confident to refactor and change your system

Then your testing strategy probably isn't good enough.

Trying to aim for a number is not going to help you. Tests are a means to an end, measure those ends instead.

Collapse
 
justintervala profile image
JustinTervala

I like this idea. Aiming for a high coverage is good, but it's equally if not more important that your tests are flexible and assert the right conditions. Simply because your test has hit a line of code doesn't imply that it has meaningfully tested that line of code. That being said, there is no chance that a line of code is tested if it isn't covered, so any changes to it could result in defects or issues refactoring.

Collapse
 
srleyva profile image
Stephen Leyva (He/Him)

I like this idea. Many people get caught up in numbers game and may even loose sight of testing the correct thing. Measuring the end game is what's important.