CheckOps home

Tools directory

D

CheckOps

doctest

doctest is an MIT-licensed, single-header C++ testing framework that is the fastest feature-rich option in compile times and runtime, letting tests live next to production code and be stripped from release binaries.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

doctest is a C++ testing framework whose README claims it is by far the fastest feature-rich option both in compile times (by orders of magnitude, with published benchmarks) and at runtime. Its syntax is inspired by Catch2 (TEST_CASE, SUBCASE, CHECK, REQUIRE), but it is designed to be light and unintrusive, so tests can be written directly in production source files, like Python docstrings or Rust #[test] functions.

Key differences listed in the README: it is ultra light to include and to use with thousands of assertions; it produces no warnings even at the most aggressive MSVC, GCC and Clang warning levels; DOCTEST_CONFIG_DISABLE removes everything testing-related from the binary; assertions are thread-safe and can be used outside a testing context as a general-purpose assert library; nothing pollutes the global namespace and it drags in no headers; and it is portable C++11 with over 100 CI builds (tag 1.2.9 supports C++98). Features include subcases, test suites, decorators, parameterised tests via templates, reporters (console, XML, JUnit) and filtering from the command line. Version 2.5.3 was released on 6 July 2026.

The source code is at doctest/doctest on GitHub under the MIT licence, with about 6,900 stars; the most recent commit was on 18 October 2026.

Features

  1. Very fast compile times: Minimal include and assertion overhead.
  2. Tests in production code: Compile them out with DOCTEST_CONFIG_DISABLE.
  3. Catch2-like syntax: TEST_CASE, SUBCASE, CHECK and REQUIRE.
  4. Warning-free and portable: Clean under strict warnings; C++11.

Pros

  1. Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 18 October 2026.
  3. Community: About 6,900 GitHub stars.

Cons

  1. Fewer extras than Catch2: No built-in benchmarking or matchers on the same scale.
  2. No mocking: Pair with a mocking library such as trompeloeil or gMock.
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

int apply(int price, int pct) { return price - price * pct / 100; }

TEST_CASE("discounts") {
    CHECK(apply(100, 0) == 100);
    SUBCASE("ten percent") { CHECK(apply(100, 10) == 90); }
    SUBCASE("full") { REQUIRE(apply(100, 100) == 0); }
}
./tests --test-case="discounts" --reporters=junit --out=report.xml

Resources:

Pricing

doctest is free and open source under the MIT licence.

  1. C++ projects sensitive to compile times.
  2. Teams wanting tests next to the code they test.

Conclusion

doctest is the lightest feature-rich C++ test framework, ideal when build speed and unobtrusiveness matter.

Compare

CheckOps pages that put doctest next to related tools. There is no paid placement on these lists.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with doctest side by side.