Code coverage done right.®

Welcome to Codecov Documentation. You'll find comprehensive guides and documentation to help you start working with Codecov as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

About Code Coverage

What is code coverage?

Code coverage is a measurement used to express which lines of code were executed by a test suite. We use three primary terms to describe each line executed.

  • hit indicates that the source code was executed by the test suite.
  • partial indicates that the source code was not fully executed by the test suite; there are remaining branches that were not executed.
  • miss indicates that the source code was not executed by the test suite.

Coverage is the ratio of hits / (sum of hit + partial + miss). A code base that has 5 lines executed by tests out of 12 total lines will receive a coverage ratio of 41% (rounding down).

Phrased simply, code coverage provides a visual measurement of what source code is being executed by a test suite. This information indicates to the software developer where they should write new tests in an effort to achieve higher coverage.

Testing source code helps to prevent bugs and syntax errors by executing each line with a known variable and cross-checking it with an expected output.

What does Codecov bring to the table?

Code coverage tools incentivize developers to write tests and increase coverage. During the process of writing tests, the developer may discover new bugs or syntax issues in the source code that are important to resolve before distributing the application.

Codecov takes coverage to the next level. Unlike open source and paid products, Codecov focuses on integration and promoting healthy pull requests. Codecov delivers or "injects" coverage metrics directly into the modern workflow to promote more code coverage, especially in pull requests where new features and bug fixes commonly occur.

Top 5 Codecov Features

  1. Pull Request Comments
  2. Commit Status (e.g., PR blocking)
  3. Merging Reports
  4. Flags e.g. #unittests vs #functional and Carryforward Flags for partial CI builds
  5. Path manipulation: Ignoring paths, fixing paths, path regexp

Codecov calculations

IDEs and coverage collecting agents report coverage differently. Codecov does not conform to any standard, nor do we make any attempt to express our metrics in the exact same way the IDE, or coverage reports, may express coverage.

Codecov's coverage ratio is: hits / (hits + misses + partials).

Codecov is a reporting tool that is intended to process any coverage report format into a format that is standard across Codecov.

You may change the configuration of how Codecov processes reports and expresses coverage information. Please review our Codecov Yaml to learn about the configuration options.

Updated 8 months ago

About Code Coverage

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.