CheckOps home

Tools directory

C

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.

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

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

  1. Embedded-friendly: Small footprint for host and target testing.
  2. Memory leak detection: Per-test leak reports.
  3. CppUMock: Expectation-based mocks for C and C++.
  4. JUnit output: CI-friendly reports.

Pros

  1. Free to use: Open source under the BSD-3-Clause licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 3 November 2026.

Cons

  1. Dated style: Macro-heavy API compared with modern C++ frameworks.
  2. Release cadence: No recent tagged releases; build from source or package managers.
#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.

  1. Embedded C and C++ teams practising TDD.
  2. 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.