Features

v.x.y.z

v.10.12.0

EmptyFileCreatorByType::registerCreator

Empty file creation is now customizable for individual file extensions.

v.10.11.0

useFileNameSanitizer

You can now customize how invalid filename characters are converted. See Converting Test Names to Valid FileNames

useEmptyFileCreator

Empty file creation is now customizable, for when you are verifying non-text files.

v.10.10.0

Storyboard

Storyboard is a utility that allows you to print the changes to an object over time

Grid

Grid is a utility that creates 2D text in a grid format

Vcpkg Integration

See Vcpkg Integration.

v.10.9.0

Custom template namer

See TemplatedCustomNamer

Options.withNamer()

Options now has the ability to specify a custom namer.

Path

See Path.h and Path.cpp

v.10.8.0

Ninja builds work when inside source tree

The entire Misconfigured Builds page of workarounds is no needed, but is retained for those using older releases.

v.10.7.0

CombinationApprovals header

Optional header argument added to CombinationApprovals.

v.10.6.0

FrameworkIntegrations class

We now have a centralised portal, FrameworkIntegrations, to all the places that you need to use, in order to add support for a new test framework.

Approvals::verify() counts as an assertion in test frameworks

Previously, Approvals wouldn’t register as an assertion, giving misleading messages and reporting, and sometimes causing a test framework to complain that there were no assertions.

v.10.5.0

Support for selecting Reporter at run-time

See How to Select a Reporter with an Environment Variable.

v.10.4.0

Support for CppUTest framework

See Using Approval Tests With CppUTest.

v.10.3.0

Approvals::verifyAll and std::initializer_list

Added std::initializer_list support to Approvals::verifyAll().

For example:

ApprovalTests::Approvals::verifyAll({10, 20, 30});

(See snippet source)

v.10.2.0

DateUtils

See DateUtils

v.10.1.1

Improved Compilation Speeds

Compilation Times: v.10.1.0: 2.7 secs vs v.10.1.1: 1.2 secs

Compilation Times: v.10.1.0: 2.7 secs vs v.10.1.1: 1.2 secs

v.10.0.0

Removed Deprecated Code

See Why We Are Converting To Options for easy ways to update your code.

Specifically, the following have been removed:

  • Methods

    • Approvals::verify(..., Reporter)

    • Approvals::verifyAll(..., Reporter)

    • Approvals::verifyExistingFile(..., Reporter)

    • Approvals::verifyExceptionMessage(..., Reporter)

    • Approvals::verifyWithExtension(...)

    • CombinationApprovals::verifyAllCombinations(Reporter, ...)

  • Macros

    • APPROVAL_TESTS_HIDE_DEPRECATED_CODE

    • APPROVALTESTS_VERSION

    • APPROVALTESTS_VERSION_MAJOR

    • APPROVALTESTS_VERSION_MINOR

    • APPROVALTESTS_VERSION_PATCH

    • APPROVALTESTS_VERSION_STR

    • APPROVALS_CATCH_DISABLE_FILE_MACRO_CHECK

v.8.9.0

v.8.7.0

Options

See Options.

StringMaker and TApprovals

This is in internal change, which will provide future flexibility, and does not change any existing code.

In this release, we:

  • templatized the Approvals class, renaming it to TApprovals

  • changed the CombinationApprovals namespace to a template class called TCombinationApprovals

  • introduced the StringMaker class as an additional customization point for the above two classes

To learn about the extra string-formatting options for your objects, see To String.

Consistent macro names

All our Macros now start with APPROVAL_TESTS_.

We have kept the old macros, redirecting to the new ones, for backwards compatibility.

Old

New

APPROVALTESTS_VERSION

APPROVAL_TESTS_VERSION

APPROVALTESTS_VERSION_MAJOR

APPROVAL_TESTS_VERSION_MAJOR

APPROVALTESTS_VERSION_MINOR

APPROVAL_TESTS_VERSION_MINOR

APPROVALTESTS_VERSION_PATCH

APPROVAL_TESTS_VERSION_PATCH

APPROVALTESTS_VERSION_STR

APPROVAL_TESTS_VERSION_STR

APPROVALS _CATCH_DISABLE_FILE_MACRO_CHECK

APPROVAL_ TESTS_DISABLE_FILE_MACRO_CHECK

v.8.6.0

Support for Boost.Test framework

See Using Approval Tests With Boost.Test

v.8.5.0

Support for Sublime Merge

Added support for Sublime Merge on Linux, macOS, and Windows (See #103)

Support for Beyond Compare on Linux

Added support for Beyond Compare on Linux (See #114).

v.8.3.0

Flexibility for adding custom merge tools

CustomReporter::create() adds flexibility for adding custom merge tools: see How to Use A Custom Reporter.

Supporting new merge tools.

See How to Submit a New Reporter to ApprovalTests.

v.8.2.0

Conan Integration documented

See Conan Integration.

v.8.1.0

Version detection

ApprovalTests provides the following macros to detect the release version, with a set of example values shown in italics:

  • APPROVAL_TESTS_VERSION_MAJOR: 8

  • APPROVAL_TESTS_VERSION_MINOR: 1

  • APPROVAL_TESTS_VERSION_PATCH: 2

  • APPROVAL_TESTS_VERSION_STR: 8.1.2

  • APPROVAL_TESTS_VERSION: 80102

v.8.0.0

CMake Integration documented

See CMake Integration.

Use with Ninja generator documented

See Troubleshooting Misconfigured Build, for explanations, fixes and workarounds.

v.7.0.0

See the v.7.0.0 milestone for the full list of changes.

Support for [Boost].UT test framework

See Using Approval Tests With [Boost].UT.

v.6.0.0

Existing Catch Project - with your main()

See Existing Project - with your main().

v.5.1.0

Continuous Integration Builds

Approval tests will now never launch any reporters on supported Continuous Integration machines.

Approving multiple files in one test

See Approving multiple files in one test

ExceptionCollector

See ExceptionCollector

Using custom writers

See Using custom writers

Using custom filename extensions

See Using custom filename extensions

v.5.0.0

Multiple output files per test

See Multiple output files per test.

SeparateApprovedAndReceivedDirectoriesNamer

See SeparateApprovedAndReceivedDirectoriesNamer

Registering a Custom Namer

See Registering a Custom Namer

Before v.5.0.0

Customizing Google Tests Approval File Names

See Using Approval Tests With Google Tests

Blocking Reporter

See Blocking Reporters

Machine Blockers

Sometimes you will want tests to only run on certain machines. Machine blockers are a great way to do this.

TEST_CASE("Only run this test on John's machine")
{
    auto blocker = ApprovalTests::MachineBlocker::onMachinesNotNamed("JOHNS_MACHINE");
    if (blocker.isBlockingOnThisMachine())
    {
        return;
    }
    // Write tests here that depend on John's environment.
    REQUIRE(ApprovalTests::SystemUtils::getMachineName() == "JOHNS_MACHINE");
}

(See snippet source)

Front Loaded Reporters

See Front Loaded Reporters

Using sub-directories for approved files

See Using sub-directories for approved files