How to unit test

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

Our great sponsors
  • Scout APM - Truly a developer’s best friend
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • talent.io - Download talent.io’s Tech Salary Report
  • SonarLint - Clean code begins in your IDE with SonarLint
  • 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 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.

  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

  • 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

    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

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.

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