liveBook · Manning

Test isolation

Test isolation is the property or practice of executing tests independently so their outcomes are not affected by other tests, shared state, dependencies, or external conditions.

How 3 Manning books explain it

Unit Testing Principles, Practices, and Patterns

The property of executing a test independently so that other tests or external influences cannot affect its outcome.

How it is used
Defines the quality goal behind unit tests and frames the classical-versus-London disagreement.
How deep it goes
Contrasts two isolation boundaries, demonstrates each with inventory tests, and links mocks to fragility and refactoring resistance.
Examples
Uses inventory-purchase tests to contrast concrete state verification with mocked interaction verification.
What you can do after
Evaluate isolation strategies and apply test doubles while accounting for parallel execution, shared dependencies, and refactoring resistance.

Read how Unit Testing Principles, Practices, and Patterns explains test isolation →

100 Go Mistakes and How to Avoid Them

Test isolation is the property that a test's outcome does not depend on state or execution effects from other tests.

How it is used
Uses dependency design to prevent time-based tests from sharing mutable state and to preserve safe parallel execution.
How deep it goes
Explains the failure mode and contrasts injected clocks with caller-provided timestamps, without detailing broader test frameworks.
Examples
Uses a Cache trimming events, a global now variable, an injected clock, and fixed timestamps in unit tests.
What you can do after
Evaluate time-dependent tests and choose injected dependencies or caller-provided timestamps to make their outcomes deterministic.

Read how 100 Go Mistakes and How to Avoid Them explains test isolation →

The Art of Unit Testing 3e

Test isolation is the property that each test runs independently without relying on or altering the state or execution of other tests.

How it is used
Protects test-suite trustworthiness by preventing tests from affecting one another through shared state or execution order.
How deep it goes
Explains order dependence, demonstrates shared-cache failure, and refactors setup with beforeEach; it stops short of broader runner mechanics.
Examples
Uses a shared UserCache, SpecialApp login tests, test.only, and beforeEach reset as concrete artifacts.
What you can do after
Diagnose order-dependent failures and refactor tests to reset shared state and arrange their own required data.

Read how The Art of Unit Testing 3e explains test isolation →

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.