A fast, single-header C++11/14/17/20/23 testing framework designed for minimal compile times and in-production-code testing.
doctest is a C++ testing framework designed for exceptional compile-time and runtime performance. It is a single-header library that supports modern C++ standards (C++11 through C++23) and allows tests to be written directly in production code, unlike many traditional frameworks. It solves the problem of slow build times and high integration overhead in C++ unit testing.
C++ developers and teams looking for a lightweight, fast testing framework that integrates seamlessly into existing codebases, especially those practicing test-driven development or needing to test internal APIs.
Developers choose doctest for its unparalleled compile-time speed, flexibility to embed tests anywhere, and minimal intrusion into codebases. Its single-header design and ability to disable all test code make it ideal for performance-critical and large-scale projects.
The fastest feature-rich C++11/14/17/20/23 single-header testing framework
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show doctest is orders of magnitude faster in compile times than alternatives like Catch2 or Google Test, drastically reducing developer wait times.
Integration requires just one header file with no dependencies, eliminating build system complexity and external package management.
Tests can be written directly in production source or header files, enabling easy testing of private APIs and lowering the barrier for test-driven development.
Supports concurrent asserts within test cases, as shown in the concurrency example, making it suitable for multi-threaded code validation.
Does not include a built-in mocking library, forcing developers to rely on external solutions or manual doubles for complex test scenarios.
Has fewer third-party integrations, plugins, and community resources compared to established frameworks like Google Test, which can slow down advanced setups.
Lacks advanced behavior-driven development syntax or fluent APIs, making it less ideal for teams preferring expressive, narrative-style tests.