Approval testing, also called snapshot testing, simplifies assertions on structured results by comparing them with a previously approved result and reporting differences. A difference is not automatically an error: investigate it, then approve the new result or fix the code. section 16.4
For outputs that are difficult to compare directly, such as PDFs or complex objects, convert the result into an easier-to-read format before comparing. Comparison libraries can report differences together, rather than stopping at the first failed assertion. section 16.4 section 16.5
A weekly sales report
A test compares a generated report with an approved version. When the Margherita sales value changes from $2700 to $2701, the diff also reveals the changed daily figure and total, helping the team assess the full impact. section 16.4
Listing 16.19 The test result produced with the changed input data
Assert.IsTrue failed. 'condition' expression: 'string.IsNullOrEmpty(reportDiff)'. Reports differ --- expected +++ actual @@ -1,6 +1,6 @@ * By Pizza * BBQ: $2100 (35%) - * Margherita: $2700 (45%) + * Margherita: $2701 (45%) * Pepperoni: $1200 (20%) * By Day * 2026-03-09: $600 (10%) @@ -9,5 +9,5 @@ * 2026-03-12: $300 (5%) * 2026-03-13: $900 (15%) * 2026-03-14: $1800 (30%) - * 2026-03-15: $1200 (20%) -* Total: $6000 (100%) + * 2026-03-15: $1201 (20%) +* Total: $6001 (100%)
Inspect the report diff to see how a small input change appears across the pizza breakdown, daily figures, and total. section 16.4



