A picture’s worth a 1000 tests.

Unit testing asserts can be difficult to use. Approval tests simplify this by taking a snapshot of the results, and confirming that they have not changed.

In normal unit testing, you say assertEquals(5, person.getAge()). Approvals allow you to do this when the thing that you want to assert is no longer a primitive but a complex object. For example, you can say, Approvals.verify(person).

Note: Approvaltests is in many languages. We suggest you start there as it is the best maintained for each project.

Step 1: Create your scenario
Step 2: Write that scenario in English
Step 3: Translate english to Code
Step 4: Create Code so it works
Step 5: Run your test for feedback while you code
Step 6: Approve result so it continues to work
Step 7: Change the requirement
Step 8: See the new solution
Step 9: Re-approve so it continues to work

More info

For more information checkout the Resources page.