liveBook · Manning

Code coverage

Code coverage measures the extent to which a test suite exercises a program’s code elements, execution paths, or behaviors.

How 14 Manning books explain it

Unit Testing Principles, Practices, and Patterns

The ratio of production-code lines executed by at least one test to the total number of production-code lines.

How it is used
Uses executed production-code lines to provide feedback about which parts of a code base tests reach.
How deep it goes
Defines the line-ratio calculation and contrasts its negative signal with its inability to guarantee test quality.
Examples
Uses IsStringLong tests, an assertion-free test, and a partially covered conditional method.
What you can do after
Evaluate test reach and detect likely under-testing without treating a coverage number as a quality guarantee.

Read how Unit Testing Principles, Practices, and Patterns explains code coverage →

Think Like a Software Engineering Manager

The proportion of source code or execution paths exercised by automated tests.

How it is used
Uses test coverage to monitor engineering quality, surface improvement areas, and assess operational excellence.
How deep it goes
Defines line, branch, and method coverage and explains benefits and limits, without detailing calculations or tooling.
Examples
Names line, branch, and method coverage and discusses unit, integration, and end-to-end testing.
What you can do after
Evaluate coverage as a signal for early defect detection and code-quality improvement, not as a guarantee.

Read how Think Like a Software Engineering Manager explains code coverage →

Shipping Go: Develop, deliver, discuss, design, and go again

Test coverage is a measure of how much of a system's code or behavior is exercised by tests.

How it is used
Guides additional testing and refactoring while providing a testing gate in continuous integration.
How deep it goes
Defines the percentage, demonstrates Go reports and a Makefile gate, and cautions that full coverage cannot establish correctness.
Examples
Uses Go coverage commands, a Makefile threshold check, an HTML report, and a CI pipeline that archives the report.
What you can do after
Apply it via Go coverage tools to find missed code, add useful tests, and enforce a coverage check in CI.

Read how Shipping Go: Develop, deliver, discuss, design, and go again explains code coverage →

Effective Platform Engineering

Test coverage is the proportion of specified code, paths, branches, or behaviors exercised by automated tests.

How it is used
Uses test coverage as a leading quality metric and as a deployment admission requirement.
How deep it goes
Defines an 80% threshold and traces result retrieval, comparison, and deployment denial through an OPA admission policy.
Examples
Uses Codacy results keyed by commit SHA, an AdmissionReview payload, and an OPA rule denying coverage below 80%.
What you can do after
Operate/configure OPA admission control to compare reported coverage with a required threshold before deployment.

Read how Effective Platform Engineering explains code coverage →

Go in Practice, Second Edition

Code coverage is a measurement of which portions of program code are executed by a test suite.

How it is used
Measures how much application code tests exercise and exposes areas that may lack testing.
How deep it goes
Calculates statement coverage and visualizes results, but does not prescribe a target such as 100 percent.
Examples
Uses foo, bar, and baz functions, tests two of them, and reports 66.7 percent coverage.
What you can do after
Diagnose/debug with it by locating code that existing tests do not exercise through command output or browser visualization.

Read how Go in Practice, Second Edition explains code coverage →

Functional Programming in JavaScript

The proportion of a program’s executable code that is exercised by a test suite or other execution run.

How it is used
Measures how thoroughly unit tests exercise functions and locates paths needing additional tests.
How deep it goes
Defines statement coverage, path traversal, and instrumentation phases, but stops short of treating coverage as a quality guarantee.
Examples
Uses QUnit tests, Blanket.js reports, showStudent variants, and contrasting 80% and 100% line-coverage results.
What you can do after
Diagnose untested code paths and add tests for missed branches, including error-handling behavior.

Read how Functional Programming in JavaScript explains code coverage →

100 Java Mistakes and How to Avoid Them

Code coverage is the fraction of program code elements executed during a test suite.

How it is used
Measures how much Java code automated tests execute and helps inspect whether conditional branches receive tests.
How deep it goes
Explains line, instruction, and branch measurement, practical thresholds, unreachable code, and the limits of treating coverage as correctness.
Examples
Uses JaCoCo reports, an unreachable Cloneable catch statement, and a single test of an integer average method.
What you can do after
Evaluate test completeness, target uncovered branches, and interpret high coverage without treating it as proof of correctness.

Read how 100 Java Mistakes and How to Avoid Them explains code coverage →

gRPC Microservices in Go

Code coverage is a metric indicating the proportion of source-code elements exercised by a set of tests.

How it is used
Identifies production code needing tests while checking microservice changes through automated test runs.
How deep it goes
Walks through package percentages, saved profiles, HTML inspection, and CI checks without detailing coverage instrumentation.
Examples
Uses mocked Order-service tests and a Go package result reporting 93.3% statement coverage.
What you can do after
Operate/configure it with Go test flags, inspect a coverage profile, and feed it into CI checks.

Read how gRPC Microservices in Go explains code coverage →

Architecture Modernization: Socio-technical alignment of software, strategy, and structure

Test coverage is a measure of how much of a codebase's behavior or structure is exercised by automated tests.

How it is used
Supports current-state complexity assessment and modernization decisions by indicating how confidently the codebase can be changed.
How deep it goes
Uses coverage as a confidence signal but stops short of treating it as sufficient without examining test quality.
Examples
Applies coverage when assessing legacy code before refactoring and pairs the metric with direct inspection of test quality.
What you can do after
Diagnose change risk by combining coverage with qualitative inspection and broader architectural indicators.

Read how Architecture Modernization: Socio-technical alignment of software, strategy, and structure explains code coverage →

"Looks Good to Me"

A measure of the proportion of source code elements or execution paths exercised by tests.

How it is used
Uses code coverage to decide how tests factor into code-review approval.
How deep it goes
Frames coverage through review-policy questions and missing-test checks, without explaining measurement methods.
Examples
Uses missing unit tests, uncovered significant use cases, and tests written only to raise coverage as review cases.
What you can do after
Evaluate whether new functionality and significant use cases have adequate unit-test coverage during review.

Read how "Looks Good to Me" explains code coverage →

Learn Go with Pocket-Sized Projects

Code coverage is the percentage or proportion of program code executed by a test suite.

How it is used
Uses test coverage to identify untested branches, paths, and edge cases during implementation and review.
How deep it goes
Defines coverage as executed code proportion and applies it through commands, but does not detail measurement internals.
Examples
Demonstrates `go test -cover`, `NewAmount` error coverage, and API response conversion tests.
What you can do after
Diagnose/debug with it by finding unexecuted branches and paths in Go tests.

Read how Learn Go with Pocket-Sized Projects explains code coverage →

Go in Action, Second Edition

Code coverage is a measurement of which portions or execution paths of a program are exercised by tests.

How it is used
Uses coverage to check whether tests exercise intended package statements and to identify gaps during development.
How deep it goes
Defines statement coverage and demonstrates command-line and browser tooling, but stops short of treating coverage as proof of correctness.
Examples
Uses a Go calculator package, coverage reports, coverage profiles, browser highlighting, and storage-error recovery tests.
What you can do after
Diagnose testing gaps with `go test -cover`, coverage profiles, and `go tool cover`.

Read how Go in Action, Second Edition explains code coverage →

The Art of Code

Test coverage is a measure of how much software code or behavior is exercised by automated tests.

How it is used
Guides judgment about whether automated tests exercise important code paths instead of becoming a standalone target.
How deep it goes
Frames meaningful coverage through success, edge, and failure paths but does not detail coverage-measurement internals.
Examples
Uses a weight converter with valid, zero, and negative-input unit tests.
What you can do after
Evaluate whether a test suite covers important behavior and expected failures without chasing metrics blindly.

Read how The Art of Code explains code coverage →

AI-Powered Developer: Build software with ChatGPT and Copilot

Code coverage is the proportion of a program’s code executed when a specified test suite runs, usually expressed as a percentage.

How it is used
Evaluates test effectiveness and exposes code areas that tests do not exercise.
How deep it goes
Defines the percentage measure, explains its limits, and gives a Python collection-and-reporting workflow.
Examples
Uses pytest commands, the coverage library, text reports, HTML reports, and an IT asset management project report.
What you can do after
Apply it via coverage and pytest to measure executed code and locate areas needing additional tests.

Read how AI-Powered Developer: Build software with ChatGPT and Copilot explains code coverage →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.