A Minimalistic, Dependency-Free and Comfortable to Use Framework

Language C++
License LGPL-3.0
Welcome to Erbsland UnitTest, a standalone C++ unit testing system, originally designed for testing Erbsland libraries and applications. Our unit testing system is built with a focus on minimal dependencies, making it theoretically dependency-free. For a more convenient usage, it requires only a minimal additional set of dependencies (CMake, Python).

Why Another Unit Test Library?

In the realm of sophisticated unit test libraries, Erbsland UnitTest stands out with its minimalistic approach. It requires no dependencies and has almost no influence on the environment of the tested code, making it ideal for simple and efficient testing.


For building unit tests with this library, ensure you have:

  • A C++ compiler supporting C++17 or newer.
  • A C++ standard library with comprehensive C++17 feature support.

For an optimal setup using CMake with minimal configuration, additionally ensure:

  • CMake (version 3.25 or newer).
  • Python (version 3.11 or newer) for compiling metadata.

A Minimal Unit Test Example

Here’s the code for a minimal unit test example, demonstrating the straightforward and intuitive nature of Erbsland UnitTest. Note how the framework simplifies the process, focusing solely on the testing logic.

All test code goes into hpp files, which are then processed by a Python script. This script generates all the necessary glue code, saving you from repetitive tasks.

Running the Unit Test

Running tests in Erbsland UnitTest offers compact, color-coded feedback. Filters based on metadata allow customization of test selection. Error summaries provide detailed insights at a glance, simplifying the debugging process and analysis.

In this example, you can see what the output of a run unit test looks like. Note that the color coding is not visible.

Design Goals


In complex projects, we have often found that unit test dependencies can create conflicts with the targets being tested. To avoid such issues, we have developed a C++ unit testing system that relies solely on a moderately modern C++ compiler and its standard library, with no additional libraries required.

For a more convenient user experience, the CMake build system and Python are required. These tools automatically generate the necessary code to register test classes, functions, and their metadata. While writing unit tests without CMake and Python is not our primary focus, it is theoretically possible to do all the registration manually.


Writing unit tests is a crucial part of developing secure and reliable software, but it can be a tedious and time-consuming task. With this in mind, we designed our unit test system to minimize setup time and reduce the required files and code structures. A minimal working unit test only requires a CMakeLists.txt, main.cpp, and ExampleTest.hpp file. See the examples later in this document.

You can quickly expand your tests by adding tags, target information, and additional error messages. This allows you to easily scale from a minimal working test to a comprehensive test suite.


We believe that unit tests with an excessive number of macros and test functions do not necessarily result in better tests; instead, they can make the unit tests overly complex. Our unit test system adopts a minimalistic approach, providing a handful of test macros that cover most use cases while maintaining easy extensibility.


Our unit test system is written in modern C++ (up to C++17) but also works with the latest C++20 features if needed. It is compatible with a wide range of compilers, even those that may not yet fully support C++17 features.


Unit tests are often run automatically on build servers. Our unit test system is designed conservatively with security in mind, ensuring a minimal attack surface. The dependency-free architecture makes it easy to verify all execution paths, provided there are no serious flaws in the C++ standard library being used.


Sometimes one single test is needed, and sometimes your unit test has thousands of tests that have to be organized into a structure and annotated with metadata. Our unit test system is flexible enough to be useful from minimal up to large and complex testing projects.

Ready to Start?

Are you eager to dive into Erbsland UnitTest? We’ve got you covered! Our Quick Start Guide is designed to provide you with a streamlined and straightforward introduction. It’s the ideal starting point for your journey with Erbsland UnitTest.

Sources and License

Find all the sources of Erbsland UnitTest on GitHub. We’ve licensed the project under the GNU Lesser General Public License. This means you’re free to use Erbsland UnitTest not just in open-source projects, but also in proprietary software, ensuring flexibility and adaptability to your specific needs.