# 100% coverage with empty tests

**URL:** <https://community.codecov.com/t/100-coverage-with-empty-tests/422>\
**Category:** Support\
**Created:** [August 7, 2019, 10:45pm UTC](https://community.codecov.com/t/100-coverage-with-empty-tests/422 "2019-08-07T22:45:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAlon](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@AAlon](https://community.codecov.com/u/AAlon)\
**Post date:** [August 7, 2019, 10:45pm UTC](https://community.codecov.com/t/100-coverage-with-empty-tests/422/1 "2019-08-07T22:45:08Z")

</div>

### Description

We had around 80% coverage, then commented out all the test cases. Instead of the coverage dropping to 0% as one would expect, it went up to 100%. It seems that codecov only identified the test code and ignored the source code itself once it wasn’t being used in the test.

Is there any solution to this? Perhaps an option to force inclusion of all source files when calculating coverage?

### Repository

> **[Code coverage done right.](https://app.codecov.io/gh/aws-robotics/cloudwatchmetrics-ros1/tree/master/cloudwatch_metrics_collector)**
>
> Hosted coverage report highly integrated with GitHub, Bitbucket and GitLab. Awesome pull request comments to enhance your QA.

---

<div class="post-metadata">

**Author:** ![jerrod](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/jerrod/32/41_2.png) [@jerrod](https://community.codecov.com/u/jerrod)\
**Post date:** [August 9, 2019, 6:38pm UTC](https://community.codecov.com/t/100-coverage-with-empty-tests/422/2 "2019-08-09T18:38:34Z")

</div>

Thanks @AAlon – excited to see AWS Robotics using Codecov! I looked into the repos.

On this case, we give power in the hands of the user for whether to “count” test files in coverage. If you don’t want your test file counting, I would recommend ignoring that and just sticking to .src

> **[Ignoring Paths](https://docs.codecov.com/docs/ignoring-paths)**
>
> You can use the top-level ignore: key to tell Codecov to ignore certain paths. Add a list of paths (folders or file names) to your codecov.yml file under the ignore key to exclude files from being collected by Codecov. Ignored files will be skipped...

Separately, it is very strange why this test file came back 100% covered and we are digging into it. [Codecov](https://codecov.io/gh/aws-robotics/cloudwatchmetrics-ros1/src/73539f37b1bdd76df1c146c8cbc948f9d82cecca/cloudwatch_metrics_collector/test/cloudwatch_metrics_collector_test.cpp)

---

<div class="post-metadata">

**Author:** ![AAlon](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@AAlon](https://community.codecov.com/u/AAlon)\
**Post date:** [August 9, 2019, 11:32pm UTC](https://community.codecov.com/t/100-coverage-with-empty-tests/422/3 "2019-08-09T23:32:30Z")

</div>

Thanks @jerrod, using “ignore” we’re able to fix the coverage reports for almost all repositories, but the one linked above is still broken. After ignoring test files we encounter report generation errors:

> **[Code coverage done right.](https://app.codecov.io/gh/AAlon/cloudwatchmetrics-ros1/commit/ca21ed427d94ccbfee4d7fda41e3cfec8151538d)**
>
> Hosted coverage report highly integrated with GitHub, Bitbucket and GitLab. Awesome pull request comments to enhance your QA.

Very odd… we’d appreciate your help finding a solution here.
