liveBook · Manning

Printer

As explained in Effective Behavior-Driven Development

A method or class that converts a result into a format that is easier to compare and approve.

When a result is hard to compare directly, a printer converts it into a clearer format. In approval testing, that format can be compared with an approved result. For a sales report, a printer can turn report data into readable text, listing totals by pizza and day. section 16.4

Keep the comparison understandable to the people reviewing it. A small example may fit directly in a feature scenario; larger approval tests may use a separate approved file. A text diff can then make changes visible. section 16.4

How Effective Behavior-Driven Development covers it

How deep it goes
Defines the conversion role and demonstrates report formatting and test integration.
Examples
Formats sales totals by pizza and day as text for comparison with an approved report.
What you can do after
Build a report printer and use its output in a comparison test.
How it connects
Connects approval testing with approved results and text diffs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Behavior-Driven Development. The section links point to the parts of the book it draws on.