GitHub - approvals/ApprovalTests.cpp: Native ApprovalTests for C++ on Linux, Mac and Windows

GitHub

GitHub CopilotWrite better code with AI | MCP RegistryIntegrate external tools | ActionsAutomate any workflow | CodespacesInstant dev environments | IssuesPlan and track work | Code ReviewManage code changes | Code QualityEnforce quality at merge | Why GitHub | Marketplace | View all features | Enterprises | Small and medium teams | Startups | View all use cases | View all industries | View all solutions | AI | Software Development | DevOps | Security | View all topics | Customer stories | Events & webinars | Ebooks & reports | Business insights | Trust center | Partners | View all resources

Approval Tests for C++

build
cygwin
mingw
python-tests
ConanCenter package
vcpkg
Documentation Status
License
Contributor Covenant

⬇️

Download the latest version (v.10.13.0) of the single header file here.

📖

Read the Docs

Contents

What are Approval Tests?

Requirements

Getting Started

ToString (ostream insertion)

What's new?

Feedback

What are Approval Tests?

Also known as Golden Master Tests or Snapshot Testing, Approval Tests are an alternative to asserts. If you are unfamiliar with them, we have an

overview

and a

tutorial

.

They are great for testing objects with lots of fields, or lists of objects.

Requirements

C++11 (or above) compiler

Mac/Linux/Windows

One of:

GoogleTest

,

Catch2

,

CppUTest

,

doctest

,

Boost.Test

,

[Boost].UT

Getting Started

Download

The Approval.cpp Starter Project

Read the

Getting Started

page

Set up your main file.

Read the

User Guide on Read the Docs

or

on GitHub

.

Watch the

Videos

ToString (ostream insertion)

Often, you will need to create functions to allow objects to print their state. This is commonly done with an ostream << operator. You can find examples here:

To String

What's new?

Check out the

Features

page or

upcoming release notes

to see what we've been working on lately, or browse the

past release notes

.

Feedback

If you have any comment or suggestion on this documentation, please email Llewellyn or Clare via the details in the

Contributing page

.