For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 you will learn from this topic

  • What code coverage is and how Harness calculates it

  • The difference between total coverage and patch coverage

  • Which coverage report formats Harness supports

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

Before you begin

Code coverage requires:

  • A valid Harness CI license

  • If you want to use Harness Code Coverage on GitHub Actions, CircleCI, or any other CI, go to codecov.io

Troubleshooting

Code coverage does not appear in the pipeline execution

Ensure you have a valid Harness CI license and that you have completed the Onboarding Guide. After your first successful pipeline run with coverage upload, results appear in the Coverage tab.

Patch coverage is not shown

Patch coverage only appears for pull request builds, not for branch pipelines. If you are running a pipeline on a branch (not a PR), only total coverage is shown. Go to Understanding Results for details on how each metric is calculated.

Next steps

Last updated

Was this helpful?