libunittest C++ library ↓latest version

libunittest is a portable C++ library for unit testing. By relying on the C++11 standard, heavy use of templates, and minimal use of macros, a portable, feature-rich, and easy-to-use library has been developed. Supported compilers are g++ (≥4.6), clang++ (≥3.2), and Visual C++ (≥2013). A minimal example: #include <libunittest/all.hpp>
using namespace unittest::assertions;


Features include:

  • unit testing framework for C++
  • great for test-driven-development (TDD) in C++
  • follows the xUnit test patterns plus extensions
  • formatted XML output of the test results (JUnit-compatible)
  • comes with rich assertions and is easily extendable
  • tests can be run in parallel
  • supports templated tests
  • option to run specific tests without recompiling
  • option to turn off exception handling for debugging purposes
  • supports setting timeouts for specific tests or all tests
  • supports test contexts that are shared across multiple tests
  • tests can be skipped while leaving a message explaining the skip
  • functionality to easily produce random values and containers
  • portable across various operating systems and compilers
  • comes with tests and examples