What is approval testing?
Answer
Approval testing (golden master testing) is a testing technique that captures the complete output of a system (a "golden master") and compares subsequent runs against it, failing if anything changes. Similar to snapshot testing but for larger, more complex outputs (entire documents, API responses, rendered HTML, serialized objects). Process: (1) Run the system once, capture output. (2) Review and approve it as correct. (3) Subsequent runs compare against the approved output — any diff fails the test. (4) When an intentional change is made, re-approve the new output. Tools: ApprovalTests (multi-language library), Verify (C# — excellent), jest-snapshot. Best for: testing legacy code without tests (characterization testing), testing complex output structures, serialization, generated code, HTML templates. Advantages: fast to write for complex outputs, catches any change. Pitfalls: same as snapshot tests — diffs must be reviewed carefully, not blindly approved. Combine with Diff tools for readable approval reviews.
Previous
What is trunk-based development and how does it relate to testing?
Next
What is the testing diamond vs testing pyramid?
More Software Testing / TDD Questions
View all →- Advanced What is the Outside-In TDD approach?
- Advanced What is the difference between sociable and solitary unit tests?
- Advanced What is trunk-based development and how does it relate to testing?
- Advanced What is the testing diamond vs testing pyramid?
- Advanced What is load testing and how do you design effective load tests?