> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/code-coverage.md).

# Code Coverage

Track how much of your code is covered by tests

Code coverage shows what percentage of your code is exercised by tests. Harness provides native code coverage tracking that displays coverage metrics directly in your pipeline execution, helping you identify untested code paths and maintain quality standards.

## What is Code Coverage

Code coverage measures how much of your source code is executed during testing. It helps you:

* Identify untested code paths
* Ensure critical functionality is covered by tests
* Track coverage trends over time
* Enforce quality standards through gates

## Types of Coverage

Harness tracks two key coverage metrics:

| Metric             | Description                                             | Best For                                            |
| ------------------ | ------------------------------------------------------- | --------------------------------------------------- |
| **Total Coverage** | Percentage of all lines in your repo covered by tests   | Understanding overall test coverage health          |
| **Patch Coverage** | Percentage of changed lines covered by tests (PRs only) | Ensuring new code is properly tested before merging |

## Supported Formats

Harness natively supports the following code coverage formats:

| Format      | File Extension   | Languages                          |
| ----------- | ---------------- | ---------------------------------- |
| LCOV        | `.info`, `.lcov` | Python, Node.js, JavaScript, C/C++ |
| JaCoCo XML  | `.xml`           | Java, Kotlin, Scala                |
| Go Coverage | `.out`           | Go                                 |

## Prerequisites

Code coverage requires:

* Feature flag `CI_CODE_COVERAGE` enabled on your account. To use `hcli` commands for uploading coverage reports, set the environment variable `CI_ENABLE_HCLI_FOR_TESTS=true` in your pipeline.
* A valid Harness CI license
* If you want to use Harness Code Coverage on Github Actions, CircleCI or any other CI, please visit [codecov.io](https://codecov.io)

Contact [Harness Support](mailto:support@harness.io) to enable the feature flag. Go to [Environment variables](/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings.md#environment-variables) to configure environment variables.

## Next Steps

* Go to [Onboarding Guide](/continuous-integration/use-harness-ci/use-harness-ci/code-coverage/onboarding.md) to integrate code coverage into your pipeline
* Go to [Understanding Results](/continuous-integration/use-harness-ci/use-harness-ci/code-coverage/understanding-results.md) to learn how metrics are calculated
