OSS Tanbou

write C++ unit tests, BDD scenarios, and micro-benchmarks in one test framework and integrate them with CMake and CTest

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
21,504
Primary language
C++
License
BSL-1.0
Repository last updated
Oct 3, 2026
On this page

Overview

Catch2 is a C++ testing framework for unit tests with built-in support for simple BDD-style scenarios and micro-benchmarks. Tests use TEST_CASE and normal-looking assertion expressions, while CMake targets and CTest discovery integrate the test executable into common C++ build workflows.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Write tests with normal-looking C++ assertion expressions

TEST_CASE defines a test and REQUIRE evaluates a boolean expression while preserving the original expression and resolved values for failure output.

Sources: [1][2]

Share local setup through SECTION and BDD macros

SECTION re-runs a test case through independent branches with fresh setup, and SCENARIO, GIVEN, WHEN, and THEN provide BDD-style aliases over the same mechanism.

Sources: [2]

Use exported CMake targets and automatic CTest discovery

Catch2 exports Catch2::Catch2 and Catch2::Catch2WithMain, and catch_discover_tests can register test cases from the built executable with CTest.

Sources: [3]

Best fit

Fits CMake-based C++ projects that want one test runner

Unit tests, BDD-style specifications, and lightweight micro-benchmarks can share a test executable and CI workflow.

Sources: [1][3]

Before adoption

Version 3 is no longer a single-header library

Catch2 v3 uses multiple headers plus separately compiled implementation. Do not reuse v2 single-header setup instructions; use CMake integration or the v3 amalgamated distribution.

Sources: [1][5]

Plan for C++14 or newer and the CMake integration requirements

The repository describes v3 as targeting C++14 and later, while the v3.16.0 top-level build requires CMake 3.16 or newer. Projects still tied to C++11 need to evaluate the v2 line separately.

Sources: [6][4]

Keep benchmarks separate from ordinary correctness runs

Catch2 benchmarks are not run by default and are selected explicitly through tags such as [!benchmark]. Treat correctness testing and performance measurements as separate CI concerns.

Sources: [1][5]

Official sources

  1. [1]Catch2 v3.16.0 README(2026-10-03)
  2. [2]Catch2 v3.16.0 tutorial(2026-10-03)
  3. [3]Catch2 v3.16.0 CMake integration(2026-10-03)
  4. [4]Catch2 v3.16.0 CMakeLists(2026-10-03)
  5. [5]Catch2 v3.16.0 release(2026-10-03)
  6. [6]catchorg/Catch2 repository(2026-10-03)
  7. [7]Catch2 Boost Software License 1.0(2026-10-03)
Supplemental curator note

Catch2 keeps assertions close to normal C++ expressions and can reduce ceremony when adding tests. Version 3 is no longer a single-header library, so use current CMake targets or the maintained amalgamated distribution instead of older v2 setup guides.

Try it in 3 steps

  1. 1

    Pin Catch2 v3.16.0 with CMake FetchContent

    Declare the release tag in CMakeLists.txt, call FetchContent_MakeAvailable(Catch2), and link the test target to Catch2::Catch2WithMain.

    FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.16.0)
  2. 2

    Create a minimal TEST_CASE

    Save this as test.cpp to exercise a normal C++ boolean expression with REQUIRE.

    #include <catch2/catch_test_macros.hpp>\nTEST_CASE("addition") { REQUIRE(1 + 1 == 2); }
  3. 3

    Build and run through CTest

    Configure include(CTest), add Catch2's extras directory to CMAKE_MODULE_PATH, include Catch, and call catch_discover_tests(tests) first.

    cmake -S . -B build && cmake --build build && ctest --test-dir build --output-on-failure
Check the official README

Growth

Growth trends · Last 30 days

21,504 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
18
Open PRs
59

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • testing
  • test-framework
  • tdd
  • bdd
  • no-dependencies
  • framework
  • cpp14
  • cpp
Stars
21,504
Forks
3,501
Watchers
460
Open issues
385
Contributors
399
Owner type
Organization
Primary language
C++
License
BSL-1.0
Repository last updated
Oct 3, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?