Asserts are a great way of checking primitives. However, they get cumbersome when you want to assert an object. Even the above example really is asking for
assertPerson(person, "jane doe, female age 5");
Of course this quickly becomes a nightmare of trying to describe the person object. This is where approvals come in.
Now you can get a test with nicely formatted output
Name : jane doe
Age : 5
Sex : Female
The more complex the object, the greater the task of writing & maintaining the asserts becomes. While approvals always stay the same one line:
So whether it’s a single object, a tree of objects, a Gui Component, an Html page, a pdf document, an email, etc… if you can output it to a file, you can approve it. Then you can always view that output in whatever manner you wish. So there’s no need to find a fancy way to describe a pdf: just view it in acrobat, and if it’s good approve it.