White-box testing
White-box testing is a software testing technique that evaluates behavior using knowledge of the software’s internal implementation, structure, or execution paths.
Functional Design and Architecture: Examples in Haskell
White-box unit testing is testing that verifies internal code paths and implementation details in addition to externally observable behavior.
- How it is used
- Uses mocks to drive business logic through controlled internal paths and dependency failures.
- How deep it goes
- Explains interface-based mocking, stateful mock interpreters, failure tests, runtime dispatch, and tracing; warns against exhaustive coverage.
- Examples
- Demonstrates mocked random values for a game picker and mocked KV-database failures while loading a labyrinth game session.
- What you can do after
- Apply it via mock interpreters and controlled runtimes to test sensitive branches and external-service failures.
Read how Functional Design and Architecture: Examples in Haskell explains white-box testing →
Write Powerful Rust Macros
White-box testing evaluates software with knowledge of and access to its internal implementation, including private code paths.
- How it is used
- Verifies procedural-macro internals and private helper behavior alongside implementation code.
- How deep it goes
- Demonstrates string, exact-stream, and parsed-AST assertions, while noting the maintenance cost of macro-specific fixtures.
- Examples
- Uses a derive-generated builder for `StructWithNoFields` and exercises testing structs with fields and unnamed-field failures.
- What you can do after
- Diagnose/debug with it by directly asserting generated output and parsing it to inspect selected syntax details.
Read how Write Powerful Rust Macros explains white-box testing →
Unit Testing Principles, Practices, and Patterns
A software testing method that verifies internal implementation behavior using knowledge of the application's source code or structure.
- How it is used
- Analyzes tests and implementation choices within a broader unit-testing strategy.
- How deep it goes
- Contrasts definitions, benefits, and brittleness but stops short of prescribing detailed test construction.
- Examples
- Compares tests derived from source code with tests derived from requirements and specifications.
- What you can do after
- Evaluate tests by balancing regression protection against brittleness and resistance to refactoring.
Read how Unit Testing Principles, Practices, and Patterns explains white-box testing →
Related concepts
- black-box testingcontrasts with · Black-box testing evaluates software through externally observable behavior and interfaces without relying on knowledge of its internal implementation.
- functional requirementmeasures · A functional requirement specifies a behavior or capability that a system must provide or enable.
- testkind of · A test is a procedure or check that evaluates behavior using specified inputs or evidence against expected results or criteria.
- endpointcontrasts with · An endpoint is a network-accessible address or interface through which a service exposes a resource or operation and handles requests and responses.
- testabilityused by · Testability is the degree to which a system’s behavior can be exercised and evaluated effectively, efficiently, and reliably through testing.
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.


