A widely used JavaScript test framework for Node.js and the browser, providing describe/it-style test structure and async test support.
catchorg/Catch2
A header-based unit testing framework for C++ with simple assertions, BDD-style macros, and basic micro-benchmarking.
- Stars
- 21,534
- Forks
- 3,437
- Open issues
- 454
- Last commit
- 17 days ago
What is it?
Catch2 is a unit testing framework for C++. Test names can be free-form strings, assertions are written as ordinary C++ boolean expressions, and sections let tests share setup and teardown code in a local way.
Beyond unit tests, Catch2 includes simple BDD macros and basic micro-benchmarking. Benchmarks are excluded from default runs and must be selected explicitly with the [!benchmark] tag.
The v3 line on the devel branch turns Catch2 from a single-header library into a normal library with multiple headers and separately compiled implementation. The v2.x branch continues to support C++11, and Catch1.x supports C++03.
Key features
- 01Test names can be arbitrary strings rather than valid identifiers.
- 02Assertions are written as normal C++ boolean expressions.
- 03Sections share setup and teardown code locally within a test case.
- 04Includes BDD-style macros for behavior-driven tests.
- 05Provides basic micro-benchmarking, run via the [!benchmark] tag.
- 06Has no external dependencies.
Use cases
- Writing unit tests for a C++ codebase with minimal setup.
- Practicing test-driven development (TDD) in C++ projects.
- Adding quick micro-benchmarks alongside existing tests.
- Organizing behavior-style specifications using BDD macros.
Things to know
- The README says the documentation is still being updated for v3 changes, so some docs may lag behind the code.
In collections
Topics
FAQ
- What is Catch2?
- A header-based unit testing framework for C++ with simple assertions, BDD-style macros, and basic micro-benchmarking. Catch2 is a unit testing framework for C++. Test names can be free-form strings, assertions are written as ordinary C++ boolean expressions, and sections let tests share setup and teardown code in a local way.
- Is Catch2 free to use? What license does it have?
- Catch2 is open source under the BSL-1.0 license. Check the license terms before using it in commercial products.
- Is Catch2 still maintained?
- Actively maintained. The last commit to Catch2 was on Oct 8, 2026.
- What can I use Catch2 for?
- Writing unit tests for a C++ codebase with minimal setup. Practicing test-driven development (TDD) in C++ projects. Adding quick micro-benchmarks alongside existing tests. Organizing behavior-style specifications using BDD macros.
- Where can I get Catch2?
- The source code and installation instructions are on GitHub: https://github.com/catchorg/Catch2
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python testing framework that makes it easy to write small tests and scales to complex functional testing for applications and libraries.
Jest is a JavaScript testing framework with built-in assertions, mocking, snapshot testing and an interactive watch mode.
A Go testing toolkit providing assertions, mocks, and a suite structure that works with the standard go test runner.
AVA is a concurrent test runner for Node.js with a concise API, detailed error output and per-file thread isolation.
PHPUnit is a programmer-oriented unit testing framework for PHP, following the xUnit architecture.