CheckOps
CppUTest
CppUTest is a BSD-3-Clause unit testing and mocking framework for C and C++, popular in embedded development for its small footprint, memory leak detection and CppUMock.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
CppUTest is a unit testing and mocking framework for C and C++. It is designed with embedded systems in mind: the core is small, written in a conservative subset of C++, and can run on targets with limited resources as well as on host machines. It is widely known through test-driven development for embedded C, where it is used to test C code from C++ test files.
Tests are grouped with TEST_GROUP (including setup and teardown) and defined with TEST, using assertions such as CHECK, CHECK_EQUAL, LONGS_EQUAL, STRCMP_EQUAL and DOUBLES_EQUAL. A built-in memory leak detector reports leaks per test by overriding new, delete, malloc and free. CppUMock provides mocks with expectations (mock().expectOneCall("write").withParameter("value", 42)), and CppUTestExt adds extensions. It builds with CMake or autotools on Unix-like systems, Cygwin, macOS and Windows, and outputs JUnit XML for CI. The repository had commits in November 2026, although there have been no recent tagged GitHub releases.
The source code is at cpputest/cpputest on GitHub under the BSD-3-Clause licence, with about 1,500 stars; the most recent commit was on 3 November 2026.
Features
- Embedded-friendly: Small footprint for host and target testing.
- Memory leak detection: Per-test leak reports.
- CppUMock: Expectation-based mocks for C and C++.
- JUnit output: CI-friendly reports.
Pros
- Free to use: Open source under the BSD-3-Clause licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 3 November 2026.
Cons
- Dated style: Macro-heavy API compared with modern C++ frameworks.
- Release cadence: No recent tagged releases; build from source or package managers.
Usage and Links (Example)
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"
extern "C" {
#include "led_driver.h"
}
TEST_GROUP(LedDriver) {
void teardown() { mock().checkExpectations(); mock().clear(); }
};
TEST(LedDriver, TurnsOnLed) {
mock().expectOneCall("io_write").withParameter("value", 1);
led_on();
}
./AllTests -ojunit
Resources:
Pricing
CppUTest is free and open source under the BSD-3-Clause licence.
Recommended for?
- Embedded C and C++ teams practising TDD.
- Projects needing leak detection in unit tests.
Conclusion
CppUTest is a proven, embedded-friendly test and mock framework for C and C++, especially well suited to TDD on constrained systems.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with CppUTest side by side.
UUnity Test (C)Unity is an MIT-licensed unit testing framework for C focused on embedded toolchains, consisting of a single C file and two headers, from ThrowTheSwitch.org alongside CMock and Ceedling.Compare with CppUTest
GGoogleTestGoogleTest is Google's BSD-3-Clause C++ test framework, merged with GoogleMock, providing xUnit-style tests, rich assertions, death tests, parameterised and typed tests, and C++ mocking.Compare with CppUTest
CCatch2Catch2 is a BSL-1.0 C++ unit testing framework with natural assertions, free-form test names, sections for shared setup, BDD-style macros and built-in micro-benchmarking.Compare with CppUTest
Ddoctestdoctest 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.Compare with CppUTest
Ggcovrgcovr is a BSD-3-Clause Python tool that summarises GCC/gcov (and LLVM gcov-compatible) coverage for C and C++, producing text, HTML, Cobertura, JaCoCo, LCOV, SonarQube, Coveralls, JSON, CSV and Markdown reports.Compare with CppUTest
SSonarQubeModernize your AI workflows with code verification for the agentic era.Compare with CppUTest