Better Unit Tests with ApprovalTests: An Open Source Library

Woody Zuill, Hunter Industries

When a unit test fails, we want clear, expressive, rich feedback so we can quickly understand the nature of the failure and get a good idea of how to fix it. Unit testing frameworks are fantastic at running tests and alerting us to any failure. Unfortunately, sometimes (or is that often?) the details of the failure are difficult to evaluate. Isn’t there some way to make the specifics jump off the screen so we don’t have to dig through all the details? ApprovalTests library does just that. Woody Zuill demonstrates how to include ApprovalTests in your current unit test framework to easily get these benefits. It works for everything from simple strings to arrays, GUIs, and complex objects. Plus, it’s free and available for C#, Java, PHP, and Ruby. To go beyond the limits of traditional assertion tests, learn how to easily enhance and build on your current unit testing skills by adding ApprovalTests.