A modern, C++-native test framework for unit tests, TDD, and BDD with micro-benchmarking support.
Catch2 is a modern, C++-native test framework designed for unit testing, Test-Driven Development (TDD), and Behavior-Driven Development (BDD). It provides a simple and natural syntax for writing tests, along with micro-benchmarking capabilities to measure performance. The framework supports modern C++ standards and aims to make testing intuitive for developers.
C++ developers who need a lightweight, easy-to-use testing framework for unit tests, TDD, or BDD, especially those working with C++14, C++17, or later.
Developers choose Catch2 for its natural syntax that feels like writing regular C++ code, eliminating the need for complex test naming conventions. Its built-in micro-benchmarking and BDD support provide additional functionality without requiring external libraries.
A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Test names don't need to be valid identifiers, and assertions look like normal C++ boolean expressions, making test writing intuitive and readable.
Sections provide a local way to share setup and tear-down code within tests, avoiding the need for global fixtures and simplifying test structure.
Includes benchmarking macros like BENCHMARK for performance testing, as shown in the example, though benchmarks require explicit tags to run.
Supports C++14, C++17, and later, with older versions like v2.x for C++11, ensuring compatibility with contemporary codebases.
v3 transitions from a single-header library to a normal library with separate compilation, requiring migration effort and potentially breaking existing setups, as noted in the README.
The README admits documentation for v3 is slowly being updated, which can hinder adoption and troubleshooting for new users or migrations.
Lacks built-in mocking support and has basic benchmarking capabilities compared to more comprehensive frameworks, necessitating external tools for complex scenarios.