All Customizations of Approval Tests


This page provides a starting point to see all the ways of controlling the behaviour of Approval Tests.

Disposable Objects

See Disposable Objects for a general overview of how most customisation of Approval Tests works.

Namers - how Approved Files are named

Output Directories

See Using sub-directories for approved files for putting Approval files in a sub-directory, to keep your tests directory tidy.

See SeparateApprovedAndReceivedDirectoriesNamer to put the Approved and Received files in adjacent directories, in order to allow a folder-diffing tool to compare the two directories.

Output File Names

See Namers for controlling how Approval files are named.

See Multiple output files per test for multiple ways to control file names when verifying more than one output file in a test.

See Using Approval Tests With Google Tests for how to control the names of Approval files if using that framework.

Filename Extensions: Although it seems like the file extension would be created by the namer, it is actually created by the writer. See below.

Writers - how things being verified are written to file

See Writers for how to customize the serialization of objects.

Filename Extensions: If you only want to change a file extension, see Using custom filename extensions.

Comparators - how files are compared

See Custom Comparators for controlling how Approval Tests determines if the Received File and Approved File are equivalent.

Reporters - how test failures are shown

See Reporters to control how test failures are shown. This is typically done by showing a diff tool.

Scrubbers - non-deterministic output

See Scrubbers for various ways to deal with non-deterministic output.