TNS
VOXPOP
What news from AWS re:Invent last week will have the most impact on you?
Amazon Q, an AI chatbot for explaining how AWS works.
0%
Super-fast S3 Express storage.
0%
New Graviton 4 processor instances.
0%
Emily Freeman leaving AWS.
0%
I don't use AWS, so none of this will affect me.
0%
DevOps / Software Development / Software Testing

Ask a Developer: Code Coverage Uncovered

100% code coverage is unrealistic for many organizations. Here’s where developers should focus tests to maximize value.
Apr 13th, 2023 12:00pm by
Featued image for: Ask a Developer: Code Coverage Uncovered

Have a development question and can’t find the answer? In our Ask a Dev column, a developer from Sentry will answer your questions about languages, frameworks, testing, performance monitoring, or whatever topic is on your mind. To submit a question, email askadeveloper@sentry.io.

Question: I find it impossible to stick to a high code coverage metric when testing my app. Do companies actually bother with this?

A: One of the major pitfalls we see folks fall into is the “100% tested code or bust” mentality. There are benefits to having 100% code coverage, but it’s important to keep in mind that achieving complete coverage may not always be possible or practical, even in larger organizations. To put this into context, we find that only about 22% of repos using Codecov have actually achieved the 100% mark. The majority of Codecov users are above 80% coverage.

In such cases, it may be better to focus on testing critical or high-risk areas of the application and the quality of your tests to see the value and return on investment.

Organizations that care about having a well-tested, resilient code base really depend on code coverage, and there’s a clear metric to show the value as the earlier you catch/prevent a defect, the “cheaper” it is for your organization to patch that error. I think we can all agree that it’s far, far better for a developer to catch a bug while writing the code than a customer to catch it for you in production no matter the size of your organization.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Pragma.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.