Skip to main content

Comparison with other frameworks

This page places µTest++ among the major C and C++ testing frameworks, to help choose a framework for a project: how the checks are written, what happens after a failure, how the tests are registered and reported, what each framework needs from the standard library, and how difficult it is to learn. It also tells the contributors which design choices of µTest++ are deliberate, and which are limitations. The footprint of a minimal test program is measured in Footprint; no timing figures are given, since they depend on the toolchain, the target, and the configuration.

The fatal and non-fatal checks of the same frameworks are compared in the User's Guide; that table is not repeated here.

The frameworks​

FrameworkLanguageWhy it is compared
Boost UTC++20The closest relative: the function comparators of µTest++ were inspired by it.
snitchC++20The closest in purpose: a lightweight C++20 framework for constrained targets, with no heap allocation and no stream library.
GoogleTestC++ (the 1.18.x branch requires C++17)The most widely used C++ framework, with GoogleMock included.
Catch2C++ (v3 requires C++14)Popular, with sections, matchers, and benchmarking.
doctestC++ (C++11 and later)Light on compile times, with a single header.
Boost.TestC++The test library of Boost, with header-only, static, and shared variants.
UnityCThe common baseline for tests on microcontrollers.
CppUTestC++ (for C and C++ code)The other reference for embedded testing, with built-in leak detection.

Embedded Unit was not included, and JUnit is not a C++ framework.

Summary matrix​

µTest++Boost UTsnitchGoogleTestCatch2doctestBoost.TestUnityCppUTest
Checks written asfunctions (macro-free)operators and functionsmacrosmacrosmacrosmacrosmacrosmacrosmacros
Operands printed on failureyesyesyesyesyesyesyestyped macrostyped macros
Output reportshuman-readable, TAPconsole, JUnit, selectable with --reporter, replaceableconsole, TeamCity, Catch2 XML, selectable with --reporter, extensibletext, XMLseveral (including JUnit and JSON)console, replaceablehuman-readable, XML, JUnittexttext, JUnit, TeamCity, Eclipse
Nested test casesyesyes (should is an alias of test)sectionsnosectionssubcasessuitesnono
Parametrised teststest_each()yesby type (TEMPLATE_TEST_CASE), no value generatorsyesyesyesyesvia the runner generatorno dedicated macro found
Built-in mockingnononoyes (GoogleMock)nononono (CMock is separate)yes (CppUMock)
Leak detectionnonono (the framework itself does not allocate)nonononooptional add-onbuilt in
Builds without exceptionsyesyes (__cpp_exceptions guards)yes (SNITCH_WITH_EXCEPTIONS)yes (GTEST_HAS_EXCEPTIONS)yes (CATCH_CONFIG_DISABLE_EXCEPTIONS)yes (DOCTEST_CONFIG_NO_EXCEPTIONS)not the single-header variant (see Footprint)not applicable (C)yes (CPPUTEST_HAVE_EXCEPTIONS)
Flash added on Cortex-M3 (Footprint)46 KiB354 KiB476 KiB411 KiB506 KiB388 KiB479 KiB1.4 KiB102 KiB
LicenceMITBoost 1.0Boost 1.0BSD-3-ClauseBoost 1.0MITBoost 1.0MITBSD-3-Clause

The entries come from the documentation and from the source code of the frameworks (the repositories at the commits listed in Sources). The exceptions row records that the source has a configuration for disabled exceptions; the footprint programs were built in that configuration for the AArch64 and RISC-V platforms, and all of them built except Boost.Test.

Footprint​

The footprint of each framework was measured with the smallest useful program: one test case with the same two checks (an equality and a condition, on volatile values, so that they are not evaluated at build time), written with the API of the framework, in its default configuration. The reference is an empty program, a main() that only returns; one more program, with a single printf() call, shows the cost of the formatted output of the C library. The programs are in tests/sources/benchmarks/footprint, and are built by the test platforms of the project.

They were built for the QEMU platforms of the tests, with the µOS++ startup and the semihosting support:

  • with the xPack GNU toolchains (arm-none-eabi-gcc 15.2.1, aarch64-none-elf-gcc 15.2.1, and riscv-none-elf-gcc 15.2.0), in the CMake release configuration (-Os), with -ffunction-sections, -fdata-sections, and --gc-sections, and with the full newlib (not newlib-nano);
  • with the exceptions enabled on the Cortex-M and Cortex-A15 platforms, and disabled on the AArch64 and RISC-V platforms, where they do not work at run time;
  • with the frameworks at the release tags listed in Sources.

The tables give the size of each program, in KiB (1024 bytes), followed, in parentheses, by the increase over the empty program of the same platform. The flash is the code and the constants (text) plus the initial values of the variables (data); the RAM is the statically allocated memory (data plus bss), without the heap and the stack used at run time.

Flash​

ProgramCortex-M0Cortex-M3Cortex-M4FCortex-M7FCortex-M33Cortex-A15 (AArch32)Cortex-A72 (AArch64)RV32IMACRV64IMAFDC
Empty program9181817880847.61.61.7
A printf() call101 (+9.9)90 (+9.0)90 (+9.0)86 (+8.7)89 (+8.9)93 (+8.9)58 (+50)45 (+43)36 (+35)
µTest++138 (+47)127 (+46)127 (+46)124 (+46)127 (+46)142 (+58)227 (+219)184 (+182)178 (+176)
Boost UT458 (+367)435 (+354)435 (+354)431 (+353)420 (+340)438 (+354)753 (+745)610 (+609)610 (+608)
snitch569 (+478)557 (+476)556 (+475)553 (+475)557 (+477)583 (+498)964 (+957)622 (+621)918 (+916)
GoogleTest516 (+425)492 (+411)492 (+411)488 (+410)477 (+397)514 (+429)820 (+812)661 (+660)661 (+659)
Catch2614 (+522)587 (+506)588 (+507)585 (+508)573 (+492)642 (+558)936 (+929)766 (+764)770 (+768)
doctest491 (+400)468 (+388)469 (+388)466 (+389)454 (+373)481 (+397)797 (+789)645 (+644)645 (+643)
Boost.Test586 (+495)560 (+479)560 (+479)557 (+479)545 (+465)609 (+525)———
Unity93 (+1.4)82 (+1.4)82 (+1.4)79 (+1.4)82 (+1.4)86 (+1.8)21 (+13)10 (+8.8)12 (+10)
CppUTest194 (+103)183 (+102)183 (+102)180 (+102)183 (+103)206 (+122)265 (+257)214 (+213)209 (+208)

RAM​

ProgramCortex-M0Cortex-M3Cortex-M4FCortex-M7FCortex-M33Cortex-A15 (AArch32)Cortex-A72 (AArch64)RV32IMACRV64IMAFDC
Empty program111111111235298.79.3
A printf() call11 (+0)11 (+0)11 (+0)11 (+0)12 (+0)35 (+0)33 (+4.0)11 (+2.2)13 (+3.6)
µTest++12 (+0.5)12 (+0.5)12 (+0.5)12 (+0.5)12 (+0.5)36 (+0.5)34 (+5.0)12 (+2.9)14 (+4.7)
Boost UT21 (+9.6)21 (+9.6)21 (+9.6)21 (+9.6)21 (+9.6)45 (+9.6)48 (+18)21 (+13)28 (+18)
snitch266 (+255)266 (+255)266 (+255)266 (+255)266 (+255)290 (+255)543 (+513)266 (+257)522 (+513)
GoogleTest20 (+8.5)20 (+8.5)20 (+8.5)20 (+8.5)20 (+8.5)44 (+8.5)46 (+16)20 (+12)26 (+16)
Catch221 (+9.5)21 (+9.5)21 (+9.5)21 (+9.5)21 (+9.5)45 (+9.5)47 (+17)22 (+13)27 (+18)
doctest21 (+9.8)21 (+9.8)21 (+9.8)21 (+9.8)22 (+9.8)45 (+9.8)48 (+18)22 (+13)27 (+18)
Boost.Test25 (+14)25 (+14)25 (+14)25 (+14)26 (+14)49 (+14)———
Unity12 (+0.2)12 (+0.2)12 (+0.2)12 (+0.2)12 (+0.2)35 (+0.2)33 (+3.6)11 (+2.1)13 (+3.4)
CppUTest14 (+2.6)14 (+2.6)14 (+2.6)14 (+2.6)14 (+2.6)38 (+2.6)37 (+7.3)15 (+6.4)17 (+7.4)

Reading the figures​

  • Compare within a column. On the Arm platforms, the µOS++ startup already links the formatted output of newlib and the C++ run-time support of the exceptions, including the demangler of the terminate handler, so the empty program takes 78 to 91 KiB and the increase is mostly the framework. On the AArch64 and RISC-V platforms the empty program has none of them (less than 8 KiB), so the increase also includes these libraries, which explains the larger figures; even the printf() call adds 35 to 50 KiB there.
  • µTest++. Of the 46 KiB added on the Cortex-M platforms, the functions of µTest++ take about 23 KiB; the rest are functions of the C and C++ libraries.
  • Unity is the smallest, as expected from a C framework with no generic comparisons. CppUTest is the next, at about twice µTest++.
  • Boost UT, doctest, GoogleTest, Boost.Test, and Catch2 add 340 to 560 KiB each on the Arm platforms, six to eleven times as much as µTest++.
  • snitch keeps the default capacities of its static buffers, which take 255 KiB of initialised data (513 KiB on the 64-bit platforms), in the flash and in the RAM; they can be reduced with its configuration options, and the figures shrink accordingly. With these defaults, its test case also needs more than the 8 KiB stack of the test platforms; on the Cortex-M33, which has a stack limit check, the overflow stops the program, while on the other platforms it goes undetected.
  • Boost.Test is the single-header variant. It does not build without exceptions, since framework_shutdown_helper uses try and catch unconditionally, and, where it builds, the program does not complete on the bare-metal platforms. It also needs BOOST_SP_DISABLE_THREADS on the Cortex-M0, which has no atomic instructions.
  • POSIX stubs. GoogleTest, Catch2, and Boost.Test call functions that a bare-metal newlib does not have (getcwd(), mkdir(), _getentropy(), and clock_gettime()); the programs link small stubs, included in the figures. CppUTest, built without exceptions, also needs CPPUTEST_STD_CPP_LIB_DISABLED and CPPUTEST_MEM_LEAK_DETECTION_DISABLED.

The figures are for a single test case with two checks; the cost of each additional check depends on the types of the operands and on the inlining, and was not measured. The run time was not measured either.

Sizes​

The sizes reported by size --format=berkeley, in bytes, for all the platforms:

The text, data, and bss sizes, in bytes

The code and the constants (text):

ProgramCortex-M0Cortex-M3Cortex-M4FCortex-M7FCortex-M33Cortex-A15 (AArch32)Cortex-A72 (AArch64)RV32IMACRV64IMAFDC
Empty program909608007680388771607952883860768915631671
A printf() call1011088933689584860208869293022555564400234256
µTest++139000127436127656124096126772143424228776186058178858
Boost UT464096440072440452436456425024443348764299619751618121
snitch320044306864305852302740306952333600462488374446415250
GoogleTest523420498780499168494588483700521340833585672095670791
Catch2623544596388596936594556581276652652952923778395781565
doctest498536474664475156472760459592488460809674655873654301
Boost.Test595160567880568236564632552864618292———
Unity9240481500817887856080952857161880491559673
CppUTest196172184380184808181440184324208124267056217072210958

The initial values of the variables (data):

ProgramCortex-M0Cortex-M3Cortex-M4FCortex-M7FCortex-M33Cortex-A15 (AArch32)Cortex-A72 (AArch64)RV32IMACRV64IMAFDC
Empty program2404240424042404277222121403236
A printf() call240424042404240427722212349218803052
µTest++252825282528252828962332370820963284
Boost UT495249524952495253204760637250326364
snitch263116263116263116263116263484262920524804262724524460
GoogleTest470447044704470450724512602048766068
Catch2468846884688468850564496600456926748
doctest467646764676467650444484598048966100
Boost.Test523652365236523656045044———
Unity241224122412241227802220283614562576
CppUTest271227122712271230802516382822883420

The variables initialised to zero (bss):

ProgramCortex-M0Cortex-M3Cortex-M4FCortex-M7FCortex-M33Cortex-A15 (AArch32)Cortex-A72 (AArch64)RV32IMACRV64IMAFDC
Empty program93449352935293529352339243000889209520
A printf() call934493529352935293523392430704930410216
µTest++972897289728972897283430431524987211056
Boost UT165921660016600166001660041176426721696021992
snitch938493849384938493843396030964952010504
GoogleTest157681577615776157761577640352410081608820328
Catch2167601676016760167601676041332420001708021320
doctest171041711217112171121711241688427041742422024
Boost.Test206882069620696206962069645272———
Unity954495529552955295523412430960964810504
CppUTest116721167211672116721167236244338441320013696

Framework by framework​

Each section below describes how the same checks are written in the framework, how a failed requirement stops the test, how the tests are registered, what the framework needs from the standard library, and how it differs from µTest++.

The reference is a small suite with a failing number check, a failing string check, a test case run for several values, and a failing requirement. This is the µTest++ version; it was compiled and run for this page, with the output of the human-readable reporter:

auto& ts = tr.add_top_suite ("Answer");

ts.test ("Number", [] (auto& t)
{
t.expect (mt::eq (answer (), 43)) << "answer is 43";
}
);

ts.test ("Text", [] (auto& t)
{
t.expect (mt::eq ("abc"sv, "abd"sv));
}
);

ts.test_each ("Sizes", { 1, 16, 512 }, [] (auto& t, int size)
{
t.expect (mt::lt (size, 100));
}
);

ts.test ("Requirement", [] (auto& t)
{
t.require (mt::eq (answer (), 43));
t.expect (true) << "not reached";
});
• Number
✗ answer is 43 FAILED (mtp.cpp:12, 42 == 43)
✗ Number - FAILED (0 checks passed, 1 failed)

• Text
✗ FAILED (mtp.cpp:15, "abc" == "abd")
✗ Text - FAILED (0 checks passed, 1 failed)

✓ Sizes (1) - passed (1 check)
✓ Sizes (16) - passed (1 check)

• Sizes (512)
✗ FAILED (mtp.cpp:18, 512 < 100)
✗ Sizes (512) - FAILED (0 checks passed, 1 failed)

• Requirement
✗ FAILED (mtp.cpp:21, 42 == 43) - test case stopped
✗ Requirement - FAILED (0 checks passed, 1 failed)

The snippets for the other frameworks are written from their documentation and headers, and were not compiled for this page; the descriptions of the mechanisms were read in the source code at the commits listed in Sources.

Boost UT​

using namespace boost::ut;

"number"_test = [] {
expect (eq (answer (), 43)) << "answer is 43";
};

"sizes"_test
= [] (int size) {
expect (lt (size, 100));
} | std::vector{ 1, 16, 512 };

"requirement"_test = [] {
expect (eq (answer (), 43) >> fatal);
};
  • Checks. expect() accepts the comparators (eq(), lt()) and the operators on typed literals (42_i); the comparators of µTest++ come from here. A failed check prints the operands.
  • Fatal failure. fatal makes the failure throw events::fatal_assertion, which the runner catches around each test, so only the current test stops, as with require() of µTest++; without exceptions, the runner writes the summary and calls std::abort() (see the User's Guide).
  • Registration. A test is created by assigning a lambda to the result of the _test literal, with no macros and no separate registration step. Parametrised tests use operator| with a container or a tuple.
  • Standard library. The header includes <iostream>, <sstream>, <fstream>, <functional>, <unordered_map>, <string>, and <vector>, among others, and keeps the output in a std::ostringstream. µTest++ does not use the stream library; on the Cortex-M platforms, a minimal Boost UT program adds about 350 KiB of flash, and the same program written with µTest++ about 46 KiB (see Footprint).
  • Reports. A console reporter and a JUnit reporter, selected with --reporter; the reporter, runner, and printer can be replaced with cfg<override>. µTest++ has TAP and human-readable reports only.
  • Other. BDD and Gherkin styles, tags, skipping. The aborts check works only on Unix-like systems.
  • Differences. Same C++20 baseline and same idea of function-like comparators; µTest++ adds suites registered by static objects, a runner with filtering and listing, the TAP report, and the avoidance of the stream library for constrained targets. Boost UT has more styles (BDD, Gherkin) and a replaceable reporter.

snitch​

TEST_CASE ("number")
{
CHECK (answer () == 43);
}

TEST_CASE ("text")
{
CHECK (std::string_view ("abc") == std::string_view ("abd"));
}

TEMPLATE_TEST_CASE ("sizes", "[sizes]", short, int, long)
{
CHECK (sizeof (TestType) < 4);
}

TEST_CASE ("requirement")
{
REQUIRE (answer () == 43);
CHECK (true);
}

The reference test case run for the values 1, 16, and 512 has no direct equivalent: snitch has no GENERATE, so the snippet parametrises by type, which is what TEMPLATE_TEST_CASE offers.

  • Checks. Catch2-style macros: CHECK and REQUIRE with the natural comparison operators, plus the _FALSE, _THAT (matchers), and _THROWS_AS variants. The expression is decomposed, so a failed check prints the operands. CONSTEXPR_* and CONSTEVAL_* variants check the expressions at compile time. The messages are limited: INFO and CAPTURE exist, but streaming into them is not supported.
  • Fatal failure. REQUIRE, FAIL, and SKIP throw to abandon the current test case, as require() of µTest++ does. When exceptions are disabled (SNITCH_WITH_EXCEPTIONS set to 0, or not available), they call std::terminate(), so the whole test application stops; the documentation recommends the CHECK*(), FAIL_CHECK(), and SKIP_CHECK() variants and a manual return. require() of µTest++ also aborts the execution when exceptions are disabled (see the User's Guide).
  • Registration. TEST_CASE defines a function and a static variable whose initialiser calls snitch::tests.add() at the static initialisation, into a global registry; the sections nest inside a test case, as in Catch2, and the test case is re-run for each leaf section. TEST_CASE_METHOD gives the fixtures, and TEMPLATE_TEST_CASE and TEMPLATE_LIST_TEST_CASE the parametrisation by type. The main function is generated with SNITCH_DEFINE_MAIN, or written by the application.
  • Standard library. The headers include <string_view>, <array>, <optional>, <variant>, <utility>, <type_traits>, <bit>, and a few other light headers, but no stream library, no std::string, and no std::vector. The documentation states that the framework does no heap allocation while running the tests, so the tests can monitor the heap use of the tested code. The price is a set of fixed capacities set at build time (SNITCH_MAX_TEST_CASES, 5000 by default, and the maximum lengths of the names, tags, messages, and expressions); longer strings are truncated.
  • Freestanding. The console (SNITCH_WITH_STDOUT) and the file output (SNITCH_WITH_STD_FILE_IO) can be disabled, and the application supplies snitch::cli::console_print and the snitch::io::file_* functions.
  • Reports. The default console reporter, plus TeamCity and Catch2 XML, selected with --reporter; an application can add its own with REGISTER_REPORTER, which µTest++ does not offer. The verbosity has four levels (quiet, normal, high, full), and the output can go to a file, with the listing of the tests, the tags, and the reporters. There is no TAP reporter.
  • Other. Tags, matchers, and a library or header-only build (snitch_all.hpp). The framework can be compiled out (SNITCH_ENABLE), to keep tests in the same file as the code. The API is a deliberate subset of Catch2, with its own list of differences; the GENERATE, BENCHMARK, and streaming messages are not planned. Test cases are not run in parallel.
  • Differences. The closest framework to µTest++ in purpose: C++20, built for constrained targets, no stream library, and runs without exceptions. snitch keeps the Catch2 macros and sections, with a stronger and explicit commitment of no heap allocation, fixed capacities, compile-time checks, and replaceable reporters, and adds a build step (a library, or the header-only implementation file). µTest++ has macro-free function comparators, the TAP report, and test cases nested in the code, without the re-running of sections.

GoogleTest​

TEST (Answer, Number)
{
EXPECT_EQ (answer (), 43) << "answer is 43";
}

TEST (Answer, Requirement)
{
ASSERT_EQ (answer (), 43);
}

class Sizes : public testing::TestWithParam<int>
{
};

TEST_P (Sizes, Below)
{
EXPECT_LT (GetParam (), 100);
}

INSTANTIATE_TEST_SUITE_P (Values, Sizes, testing::Values (1, 16, 512));
  • Checks. Macros of the form EXPECT_* and ASSERT_* for each comparison. The expression is not decomposed: the operands are printed because the macro receives them as arguments.
  • Fatal failure. ASSERT_* expands to a return statement (GTEST_FATAL_FAILURE_), so it can be used only in functions returning void, and, in a helper function, it leaves only the helper. require() of µTest++ stops the whole test case, from any call depth, by throwing, or aborts the execution when exceptions are disabled.
  • Registration. The TEST macros define a class and register it at the static initialisation, with MakeAndRegisterTestInfo(). Fixtures are classes (TEST_F), and TEST_P with INSTANTIATE_TEST_SUITE_P give the parametrised tests.
  • Standard library. <ostream>, <sstream>, <string>, <set>, <vector>, and <memory> are included by gtest.h; the framework uses the heap freely. The documentation states C++17 for the 1.18.x branch.
  • Reports. Console output and XML (XmlUnitTestResultPrinter); the listeners can be replaced.
  • Other. GoogleMock is in the same repository; the death tests, the typed tests, and the environment classes have no equivalent in µTest++.
  • Differences. GoogleTest is the broadest framework and the one with the largest ecosystem, and it uses the heap and the stream library freely. µTest++ has no mocking, no fixture classes, and a smaller feature set.

Catch2​

TEST_CASE ("number")
{
CHECK (answer () == 43);
}

TEST_CASE ("sizes")
{
int size = GENERATE (1, 16, 512);
CHECK (size < 100);
}

TEST_CASE ("requirement")
{
REQUIRE (answer () == 43);
}
  • Checks. The macros CHECK() and REQUIRE() decompose the expression with Decomposer and ExprLhs (catch_decomposer.hpp), so the natural operators are used and the operands are reported. µTest++ obtains the same report with function comparators and no macro.
  • Fatal failure. REQUIRE() throws a TestFailureException, caught by the run context, which stops the test case. With exceptions disabled (CATCH_CONFIG_DISABLE_EXCEPTIONS) a failed REQUIRE() calls std::terminate(), as described in the User's Guide.
  • Registration. TEST_CASE registers at the static initialisation. SECTION re-runs the test case once for each leaf section, a model different from the nested test cases of µTest++, which run once. GENERATE runs the test case for each generated value, and TEST_CASE_METHOD provides fixtures.
  • Standard library. <string>, <vector>, and <iosfwd> in the public headers; the library is compiled (a static library target, with the C++14 minimum), and the single-header use is no longer the primary distribution.
  • Reports. Several reporters, including console, compact, JUnit, JSON, and Automake, and event listeners.
  • Other. Matchers, micro benchmarking, and BDD macros.
  • Differences. Catch2 offers the richest assertion and generator facilities of the macro frameworks; its features come with a compiled library and a footprint about eleven times that of µTest++ (see Footprint).

doctest​

TEST_CASE ("number")
{
CHECK_EQ (answer (), 43);
}

TEST_CASE ("sizes")
{
for (int size : { 1, 16, 512 })
{
SUBCASE (std::to_string (size).c_str ())
{
CHECK_LT (size, 100);
}
}
}

TEST_CASE ("requirement")
{
REQUIRE_EQ (answer (), 43);
}
  • Checks. CHECK() decomposes the expression with Expression_lhs, and the CHECK_EQ() family takes the operands as arguments. The framework has its own String class and includes few standard headers; its documentation claims low compile times, which were not measured here.
  • Fatal failure. REQUIRE() calls throwException(), which throws a TestFailureException and stops the test case. With DOCTEST_CONFIG_NO_EXCEPTIONS, the fatal macros are rejected at compile time or, with a configuration macro, behave as CHECK() (see the User's Guide).
  • Registration. TEST_CASE registers at the static initialisation. SUBCASE re-runs the test case as the sections of Catch2. TEST_CASE_FIXTURE and TEST_CASE_TEMPLATE provide fixtures and templates.
  • Reports. IReporter and DOCTEST_REGISTER_REPORTER allow custom reporters; the console reporter is the default.
  • Other. The tests can be written in the production code and removed from the binary with DOCTEST_CONFIG_DISABLE. Requires C++11.
  • Differences. Its documentation emphasises the compile times, which were not measured here; its footprint is close to that of Boost UT (see Footprint). It is a single header with macros; it has subcases, fixtures, and replaceable reporters; µTest++ has the TAP report and the platform support of the µOS++ project.

Boost.Test​

BOOST_AUTO_TEST_CASE (number)
{
BOOST_CHECK_EQUAL (answer (), 43);
}

BOOST_AUTO_TEST_CASE (requirement)
{
BOOST_REQUIRE_EQUAL (answer (), 43);
}
  • Checks. BOOST_CHECK*, BOOST_REQUIRE*, and BOOST_TEST(), which decomposes the expression. The family of floating-point, string, and collection comparisons is among the largest.
  • Fatal failure. BOOST_REQUIRE* aborts the test case through the execution monitor (execution_monitor.ipp), which catches the execution_aborted exception; the monitor also reports the signals and the system errors. BOOST_NO_EXCEPTIONS is handled in most of the source, but not in unit_test_main.ipp, so the single-header variant does not build without exceptions (see Footprint).
  • Registration. BOOST_AUTO_TEST_CASE and BOOST_FIXTURE_TEST_SUITE register at the static initialisation; the decorators set the labels, the dependencies, and the expected failures. BOOST_DATA_TEST_CASE (boost/test/data) provides the data-driven tests.
  • Standard library. The utilities include <sstream>, <iostream>, and <ostream>; the library is used header-only, static, or shared, and it depends on other Boost libraries. The single-header variant was built for the footprint measurements; the other variants need the rest of Boost.
  • Reports. Human-readable, XML, and JUnit log and report formats.
  • Differences. A large, mature framework with a rich test tree (decorators, dependencies, timeouts); µTest++ has only suites and nested test cases, and it does not depend on Boost.

Unity​

void
test_number (void)
{
TEST_ASSERT_EQUAL_INT_MESSAGE (43, answer (), "answer is 43");
}

void
test_text (void)
{
TEST_ASSERT_EQUAL_STRING ("abd", "abc");
}

int
main (void)
{
UNITY_BEGIN ();
RUN_TEST (test_number);
RUN_TEST (test_text);
return UNITY_END ();
}
  • Checks. One macro for each type and comparison (TEST_ASSERT_EQUAL_INT, TEST_ASSERT_EQUAL_STRING, ...), written in C. The macros are typed, so the operands are printed with the right format, but there is no generic comparison, and no custom types.
  • Fatal failure. All the assertions are fatal: TEST_ABORT() calls longjmp() to the frame saved with setjmp() by TEST_PROTECT(), which does not run the destructors of C++ objects. UNITY_EXCLUDE_SETJMP_H removes the dependency.
  • Registration. None in the core: the tests are listed in main() with RUN_TEST(), or collected by the Ruby script auto/generate_test_runner.rb, which also gives the TEST_CASE, TEST_RANGE, and TEST_MATRIX parametrised tests.
  • Standard library. The core has no allocation (malloc is not used in unity.c); the output goes through UNITY_OUTPUT_CHAR, which defaults to putchar(), and can be redirected.
  • Reports. Text on the console; the scripts under auto/ convert it.
  • Other. The extras folder has the fixture, BDD, and memory tracking add-ons; CMock, for mocking, is a separate project.
  • Differences. Unity is the minimal baseline: a C file and two headers. It tests C well, but it has no generic comparisons, no nested tests, and no suites. µTest++ requires C++20 and a C++ runtime, and gives in exchange the generic checks, the suites, and the TAP reports, for about 46 KiB of flash on the Cortex-M platforms, against 1.4 KiB for Unity (see Footprint).

CppUTest​

TEST_GROUP (Answer){};

TEST (Answer, Number)
{
LONGS_EQUAL_TEXT (43, answer (), "answer is 43");
}

TEST (Answer, Text)
{
STRCMP_EQUAL ("abd", "abc");
}
  • Checks. Typed macros (LONGS_EQUAL, STRCMP_EQUAL, CHECK_EQUAL), with no non-fatal variants: a failed check stops the test.
  • Fatal failure. With exceptions, the failure throws a CppUTestFailedException (Utest.cpp), caught by the test shell; without them, TestTerminatorWithoutExceptions is used.
  • Registration. TEST_GROUP and TEST define a class and a static instance of it, which registers at the static initialisation; setup() and teardown() of the group wrap each test.
  • Memory. MemoryLeakDetectorNewMacros.h redefines new to pass the file and line, so the leaks are reported with their location; a checkpoint is compared before setup() and after teardown(). µTest++ has no equivalent.
  • Standard library. The use of the C and C++ libraries is switched by CPPUTEST_USE_STD_C_LIB and CPPUTEST_USE_STD_CPP_LIB; exceptions and RTTI are detected (CPPUTEST_HAVE_EXCEPTIONS, CPPUTEST_HAVE_RTTI).
  • Reports. Console, JUnit (-ojunit), TeamCity, and Eclipse.
  • Other. CppUMock, for mocks.
  • Differences. The other embedded reference. It has mocking, leak detection, and a long record on small targets, with macros and typed checks. µTest++ has generic checks and nested test cases, with C++20 as the price.

Design choices of µTest++​

Checks without macros​

The checks of µTest++ are function calls that capture the source location with a defaulted parameter, in place of the macros of snitch, GoogleTest, Catch2, doctest, Boost.Test, Unity, and CppUTest. Boost UT also offers a macro-free usage. The consequence is that the checks obey the rules of the language (scope, types, overloads), and that an application comparator is an ordinary template, as described in Expression templates and comparators.

Operands reported by the comparators​

Like Boost UT, µTest++ reports the actual operands and the operator of a failed check. The difference is that it does so through function comparators such as eq() and lt(), with the operators kept only as a deprecated feature, and without the C++ stream library; this is the origin of its smaller footprint, measured in Footprint. The formatting is described in The expression formatter.

Reports in TAP​

The reports are in the TAP format, which the TAP-aware tools consume directly, with a human-readable reporter on request. The reporter is selected with an option; custom reporters are not supported, whereas Boost UT can replace its reporter and runner, snitch and doctest can register reporters, and Boost.Test, Catch2, GoogleTest, and CppUTest provide several output formats.

Registration with static objects​

The suites are defined as static global objects, registered by the static constructors, with the intrusive list of Test cases and suites that does not depend on the construction order. The test cases are not registered: they run within the call that creates them. This differs from the macro-based registration of snitch, GoogleTest, Catch2, doctest, Boost.Test, and CppUTest, and from the runner generation used with Unity.

Embedded targets​

The framework is built to run on bare-metal targets, with no dependency on the stream library, with a stack-based execution of the test cases, and with a build that does not use exceptions, where a failed requirement aborts the test execution. snitch, Unity, and CppUTest also target embedded systems; snitch is the closest, a C++20 framework with no stream library and no heap allocation; Unity is written in C and CppUTest is a C++ framework, all three with macros for the checks.

Learning curve​

The estimate below is an editorial judgement, not a measurement: no user study was made. It is based on how much a new user must learn before writing a first useful test, how many distinct concepts the framework has, and which mistakes the design makes easy. The sizes are approximate counts from the sources and the documentation folders at the commits in Sources.

FrameworkFirst testFull useAPI size (approximate)Main source of difficulty
µTest++easy for C++ developersmoderate12 function comparators and helpers, plus the runner, the suites, and the test casesthe object model (runner, suite, test case, t) and the mt:: qualification
Boost UTmoderatesteep48 exported names and 3370 lines in a single headeroperators, literals, and the | syntax
snitcheasymoderate36 documented macros; a README and 3 documentation pages, about 11 000 words, and about 4100 lines of headersthe fixed capacities, the build configuration macros, and the missing Catch2 features
GoogleTesteasymoderate to steepabout 42 EXPECT_* and ASSERT_* macros; 19 documentation pages, about 66 000 wordsfixtures, parametrised tests, GoogleMock
Catch2easymoderatefew assertion macros; 35 documentation pages, about 51 000 wordssections and generators re-run the test case
doctesteasymoderateabout 66 assertion macros; 16 documentation pages, about 18 000 wordssubcases, configuration macros
Boost.Testmoderatesteepabout 93 assertion and suite macrosseveral usage variants, the Boost build, the test tree
Unityeasymoderateabout 450 typed TEST_ASSERT_* macroschoosing the right typed macro, the runner generator
CppUTestmoderatemoderateabout 60 assertion macrosthe build flags, the memory-leak detector

The first-test column is the effort to get a failing check reported; the full-use column is the effort to use fixtures, parametrised tests, custom types, and the command line with confidence.

µTest++​

The comparators are few and regular (eq(), ne(), lt(), le(), gt(), ge(), and the others), and there are no macros, so the compiler diagnostics refer to ordinary functions. The difficulties are of another kind:

  • The object model must be learned first. A test is written on an object (t.expect (...)), obtained from a suite, itself obtained from a runner. A test is not a free function or a macro as in the other frameworks.
  • The function comparators are an unusual idiom. A user who writes t.expect (answer () == 42) gets a check that passes or fails without the operands; t.expect (mt::eq (answer (), 42)) is needed for the report. The deprecated operators are a source of confusion in older examples.
  • The namespace must be written. The guide recommends the mt:: prefix, so the checks are longer than CHECK_EQ.
  • The requirement of C++20 can be a difficulty for a project that does not yet use it; the header stops older compilers with an explicit #error.
  • No fixtures, mocks, or leak detection. A user coming from GoogleTest or CppUTest must find other ways; the framework has no page that maps their concepts.
  • The embedded set-up is outside the framework. Semihosting, the console, and the start-up code are explained in the User's Guide, but they remain a larger task than the first check.

Boost UT​

The macro-free syntax is compact but unusual: the literals ("name"_test, 42_i), the assignment of lambdas, the | operator for parametrised tests, the >> fatal suffix, and the cfg<override> configuration. Errors in template-heavy expressions produce long compiler messages. The single header has 3370 lines and relies on concepts and, when available, <format>.

snitch​

The first test is as simple as in Catch2, since the macros and the comparison operators are the same, and the documentation is short. The difficulties are of the embedded kind:

  • The API is a subset of Catch2. A user who knows Catch2 must check the comparison page: no GENERATE, no streaming in INFO, no BENCHMARK, and only some of the exception checks.
  • The capacities are fixed. The number of test cases, the length of the names, of the expressions, and of the messages are set at build time; a larger application needs the configuration, and long text is truncated.
  • The behaviour changes without exceptions. A failed REQUIRE stops the application, not only the test case, so the CHECK variants and a manual return must be used.
  • The configuration is by build options. The console, the file output, the exceptions, the timings, and the reporters are switched by CMake or meson options, or by macros, and the freestanding functions must be set before any other call.
  • Sections re-run the test case, as in Catch2.

GoogleTest​

The first test is easy, and the documentation is complete, but long. The difficulties come later: the difference between EXPECT_* and ASSERT_* (which only returns from the current function), the fixtures with TEST_F, the parametrised tests with TEST_P and INSTANTIATE_TEST_SUITE_P, the death tests, and the matcher language of GoogleMock. The build is the other cost: the library must be built with the same flags as the tests.

Catch2​

The first test is the simplest of all: one macro, and natural comparison operators. The model needs care later: the SECTION blocks re-run the test case from the start for each leaf, which surprises the users who expect a single run; GENERATE has the same effect. The split of v3 into a compiled library, and the many reporters, listeners, and matchers, add to the documentation that must be read.

doctest​

The API follows Catch2 closely, so the first test is equally easy, and the documentation is the shortest of the C++ frameworks. The configuration is by macros defined before the include (DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN, and others), which must be set in exactly one source file. The SUBCASE semantics are those of the Catch2 sections.

Boost.Test​

The several usage variants (header-only, static, shared) and the choice of the entry point are the first obstacle. The test tree with decorators, dependencies, labels, and fixtures is powerful and takes time to master. The tools are numerous (BOOST_CHECK, BOOST_REQUIRE, BOOST_TEST, and the _EQUAL and _MESSAGE variants). The dependence on the rest of Boost makes the set-up heavier outside a Boost project.

Unity​

Writing a test is simple: a function and RUN_TEST(). The difficulties are the size of the macro set, since each type has its own assertion (_INT, _UINT8, _FLOAT, _STRING, _MEMORY, and so on) and a wrong choice gives a wrong or unreadable report; the need to run the Ruby script, or to maintain the list of tests by hand; and the absence of C++ features, such as the destructors on failure (longjmp()). The documentation is split between the core, the extras, Ceedling, and CMock.

CppUTest​

The macros are few and the test groups are easy to read. The difficulties are the build configuration (the C and C++ library switches, the exceptions, and the RTTI), and the memory-leak detector, which redefines new and conflicts with the code that declares its own operator new, so the include order matters. The leak failures that come from the lazy initialisation of the tested code are confusing at first.

Limits and trade-offs of µTest++​

  • No compile-time variants of the checks. expect() and require() run at run time; the function comparators can be used in static_assert() (see the User's Guide), but a failure there is reported by the compiler, without the operands. snitch has CONSTEXPR_* and CONSTEVAL_* variants of its check macros.
  • No mocking. GoogleTest includes GoogleMock and CppUTest includes CppUMock. With Unity, the mocks come from the separate CMock project.
  • No leak detection. CppUTest takes a checkpoint of the allocations before the set-up and compares it after the tear-down; Unity has an optional add-on that tracks the malloc() and free() calls.
  • No fixture classes. The body of a suite or of a test case is ordinary code, shared by the nested test cases; the fixtures of GoogleTest, Boost.Test, and doctest have no direct equivalent.
  • No custom reporters. See above; snitch registers them with REGISTER_REPORTER.
  • A requirement of C++20. Boost UT and snitch have the same requirement, but doctest needs C++11, Catch2 v3 needs C++14, and GoogleTest 1.18.x needs C++17. An embedded toolchain without C++20 cannot build µTest++.
  • A small ecosystem. The user community and the third-party tooling are much smaller than those of GoogleTest and Catch2.

Sources​

The footprint was measured at the release tags below, with µTest++ at commit 59947cf1 (2026-11-15); the versions are also listed in frameworks.jsonc, from which the test scripts fetch them.

FrameworkReleaseCommit
Boost UTv2.3.1f923e6fe
snitchv1.3.2cec4a04b
GoogleTestv1.18.0063de7e9
Catch2v3.16.108092139
doctestv2.5.32d0a9359
Boost.TestBoost 1.92.0the release archive
Unityv2.7.0b6763fbd
CppUTestv4.067d2dfd4

The other statements about the frameworks come from their documentation and from their source code, consulted in November 2026 on the development branches, close to these releases; a feature that is only on a development branch (snitch, for example, was at version 1.4.0) may be described here before it is released.

The frameworks change; verify the details before relying on them, and update this page when a statement is found to be out of date.