How to unit test

This page summarizes the projects mentioned and recommended in the original post on /r/cpp_questions

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Catch

    A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)

  • https://github.com/catchorg/Catch2 is simple, but powerful testing framework. I'm using it in my projects.

  • doctest

    The fastest feature-rich C++11/14/17/20/23 single-header testing framework

  • doctest is my favorite framework. Really simple to use, header only, supports compile-time tests, lots of features and it works well with cmake.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Google Test

    GoogleTest - Google Testing and Mocking Framework

  • If you just want a simple guide on how to run unit tests: 1. Get a unit test library (I like googletest https://github.com/google/googletest) 2. Use cmake to link against it (I expect you know how to use cmake, if you dont, hit me up and I can give you great resources on it, its really important when working with c++) 3. Use the basic googletest syntax for testing your c++ code, its pretty simple (https://www.youtube.com/watch?v=YiBepqOvL8E&t=56s)

  • ut

    C++20 μ(micro)/Unit Testing Framework

  • meson

    The Meson Build System

  • Same, I use doctest and it integrates well with meson (which I prefer over CMake).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts