---
title: "Discussion on \"Why reaching 100% Code Coverage must NOT be your testing goal (with examples in C#)\" | Hashnode"
description: "Discussion on \"Why reaching 100% Code Coverage must NOT be your testing goal (with examples in C#)\". Code Coverage is a valuable metric in software development, especially when it comes to testing. It provides insights into how much of your codebase is exercised by your test suite.\nHowever, we must recognize that Code Coverage alone should not be th..."
url: "https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why reaching 100% Code Coverage must NOT be your testing goal (with examples in C#)](https://code4it.hashnode.dev/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c?utm_source=hashnode&utm_medium=feed)

Code Coverage is a valuable metric in software development, especially when it comes to testing. It provides insights into how much of your codebase is exercised by your test suite. However, we must recognize that Code Coverage alone should not be th...

Aug 28, 2024 · 8 min read · code4it.hashnode.dev  
Read the article

-   [#csharp](https://hashnode.com/tag/csharp)
-   [#code-coverage](https://hashnode.com/tag/code-coverage)
-   [#unit-tests](https://hashnode.com/tag/unit-tests)
-   [#testing](https://hashnode.com/tag/testing)
-   [#code-quality](https://hashnode.com/tag/code-quality)

## Written by

[Davide Bellone](https://hashnode.com/@davidebellone)

@davidebellone · Turin, Italy

  
[View profile](https://hashnode.com/@davidebellone)

Principal backend developer | Content Creator | Microsoft MVP

I’m a Principal Backend Developer with more than 10 years of professional experience. I’ve been working with Microsoft platforms and frameworks since 2014. I’ve worked with many tools and frameworks, such as Azure, MongoDB, Docker, and, of course, .NET and C#. I love learning new things, and I think that the best way to learn is to share: that’s why I started my journey as a content creator and conference speaker.

## Responses 1

Markdown supported · ⌘↵ to post

[Janet Oscar](https://hashnode.com/@Jenny91)

[Sep 28, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66f891029436965eac5c6cfc)

I love the grounded reality of @harold\_kendrickfx Mentorship program on instagram, despite the current economic recession I'm so happy withdrawing my $94k profits out of my investment with their platform 𝐰𝐭𝐬𝐩 𝗵im ✙𝟰𝟰𝟳𝟰𝟬𝟳𝟲𝟬𝟬𝟭𝟲𝟲..

[Eka Intan](https://hashnode.com/@Bagas31pro)

[Sep 10, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66e00f6479328aaedf391de3)

[Nice Theme](https://bagas31.pro/nitro-pdf-pro-unduh-gratis/) [And Colour scheme](https://bagas31.pro/autodesk-inventor-pro-gratis-download/)[Really impressed](https://bagas31.pro/wps-office-full-crack/)

[Alina](https://hashnode.com/@subislav)

[Sep 3, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d76008591b49dddb21fe61)

Hello, if you do satvki, it is only on this site online, - [registration](https://melbetug.app/registration/) the best sports betting girls on this site, it is definitely able to give you the same experience of the game that you are looking for, what is better than betting on your favorite team and when the game is over, in addition to positive emotions, you will receive money and the chances that you will win are very high, I actively win here.

[Alina](https://hashnode.com/@subislav)

[Aug 31, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d263b0c430127c3ab01337)

I love to play on this site from Australia - [royalreels11.com/,](https://royalreels11.com/,) royal reels australia, I love to play on this site without a doubt the coolest site on which I play and win without any problems I play on slot machines that are on this site and there are many of them here, but I chose for myself those on which I like to play the most and you can also find them for yourself

[Alina](https://hashnode.com/@subislav)

[Aug 31, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d2639bfbda91fbb639892b)

I love to play on this site from Australia - [royalreels11.com/,](https://royalreels11.com/,) royal reels australia, I love to play on this site without a doubt the coolest site on which I play and win without any problems I play on slot machines that are on this site and there are many of them here, but I chose for myself those on which I like to play the most and you can also find them for yourself

[Kazys Račkauskas](https://hashnode.com/@EasyTdd)

[Aug 29, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d1061ff3a6f8cf7f15a929)

What is your opinion about test-driven development and the role of test coverage in this context? As a TDD practitioner, I actually never calculate this metric.

[Davide Bellone](https://hashnode.com/@davidebellone)

[Aug 30, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d1061ff3a6f8cf7f15a929#reply-66d174abfdb70582c4316e86)

IMHO, since TDD focuses too much on code implementation and is tightly coupled with the code (simply, method names and parameters must match), this metric still does not mean you're safe.

If your tool allows you to see the lines of code covered by tests, you can use it to see the parts of the code that are NOT covered by any test - then you can write, if necessary, some more tests.

However, in general I think that following the Test Diamond strategy is more beneficial (if you don't know what it is, here's a short introduction: [code4it.dev/architecture-notes/testing-pyramid-vs…](https://www.code4it.dev/architecture-notes/testing-pyramid-vs-testing-diamond/) )

[Kazys Račkauskas](https://hashnode.com/@EasyTdd)

[Aug 30, 2024](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/66cefa886ffb3c281cee50ee/comment/66d1061ff3a6f8cf7f15a929#reply-66d1781fc163186394b997dc)

[Davide Bellone](https://hashnode.com/posts/why-reaching-100-code-coverage-must-not-be-your-testing-goal-with-examples-in-c/@davidebellone) Yes, I have read your article about the diamond strategy, and I feel it doesn't quite fit with TDD. Test-driven development isn't just about testing; it's more about the development process as a whole. However, I do agree with your point about the importance of integration and end-to-end tests—these are crucial in the TDD approach as well. I find it challenging and expensive to cover numerous cases with integration or e2e tests. As you mentioned in your example, many cases were left untouched, even with a simple scenario. This issue becomes even more pronounced in complex enterprise-level applications, where the number of variables and potential cases for integration tests grows exponentially.
