Code Quality

What is Test Coverage?

Test coverage describes how thoroughly a test suite exercises a system — spanning code coverage, requirement coverage, and risk coverage as complementary measures of test completeness.

By the Hyrax team·4 min read·May 1, 2026
TL;DR
  1. 1.Definition
  2. 2.Dimensions of Test Coverage
  3. 3.Test Coverage in Practice
  4. 4.Coverage Gaps and Their Consequences
  5. 5.Test Coverage and Autonomous Code Governance

Definition

Test coverage is a broad term describing how thoroughly a test suite exercises the system under test. While often used interchangeably with "code coverage," test coverage is the larger concept: it includes not just how much code is executed during testing, but also how completely the system's requirements, behaviors, and risk scenarios are tested.

The distinction matters: high code coverage can coexist with low requirement coverage (you ran all the code but didn't test the most important behaviors) and low risk coverage (you tested the happy path but not the failure scenarios).

Dimensions of Test Coverage

Code coverage

The percentage of source code executed during the test run. Measured by instrumentation tools (Istanbul, JaCoCo, coverage.py). The most commonly tracked coverage metric because it is easy to measure.

Requirement coverage

Whether each specified requirement or user story has at least one test that verifies it. Code coverage does not guarantee requirement coverage — code can be executed without testing the specific behavior it is supposed to provide.

Risk coverage

Whether high-risk scenarios — error conditions, edge cases, security-sensitive inputs, concurrency issues — are tested. Code coverage tools do not distinguish between testing a happy path and testing a critical security boundary.

Integration coverage

Whether the interactions between system components are tested — not just individual units in isolation. High unit test coverage can coexist with low integration coverage if modules work correctly in isolation but fail when combined.

Test Coverage in Practice

A comprehensive test coverage approach combines multiple coverage types:

  1. Unit tests for individual functions and classes — targeting high code coverage
  2. Integration tests for component interactions — targeting integration coverage
  3. End-to-end tests for complete user flows — targeting requirement coverage
  4. Negative and edge-case tests for error handling and boundary conditions — targeting risk coverage

Coverage Gaps and Their Consequences

Coverage gaps create blind spots:

  • Uncovered code paths contain bugs that tests never catch — shipping broken code
  • Uncovered requirements mean functionality that was supposed to exist does not work — shipping incomplete features
  • Uncovered risk scenarios mean the system fails predictably in conditions that were known but not tested

Test Coverage and Autonomous Code Governance

Test coverage is both an input and an output in autonomous code governance. As an input, coverage data informs which areas of the codebase lack testing — directing autonomous test generation to fill the gaps. As an output, every fix Hydra generates includes baseline tests that contribute to overall test coverage, incrementally improving the codebase's test posture over time.

The combination of autonomous fix generation and autonomous test generation means that governance activity directly improves coverage, rather than treating coverage improvement as a separate initiative.

Frequently Asked Questions

Is test coverage the same as code coverage?

Code coverage is one dimension of test coverage. Test coverage is broader: it includes requirement coverage (did you test what you were supposed to build), risk coverage (did you test the dangerous scenarios), and integration coverage (did you test the interactions between components). Code coverage tools measure the code-execution dimension only.

What tools measure test coverage?

Code coverage: Istanbul/nyc (JavaScript), JaCoCo (Java), coverage.py (Python), gcov (C/C++), SimpleCov (Ruby). Requirement coverage: typically tracked in test management tools (Jira, TestRail) by linking tests to requirements. Risk and integration coverage are harder to measure automatically and rely more on review and test planning.

How much test coverage is enough?

There is no universal answer. 80% line coverage is a common minimum target. Security-critical code often warrants 90%+. More important than the percentage is what is covered: test the most important requirements, the highest-risk scenarios, and the code that changes most frequently.

Stop flagging. Start fixing.

Hyrax reviews your pull requests, remediates issues autonomously, and closes the ticket.

Join the waitlist