talira

A C++ unit testing framework with micro-benchmarks and BDD macros

open sourceBSL-1.0free

Catch2 is a unit testing framework for C++14 and later. Test names are free-form strings, assertions are written as ordinary C++ boolean expressions, and sections share set-up and tear-down code inside a test case without fixtures. It also has basic micro-benchmarking and simple BDD-style macros, matchers, generators for data-driven tests, and reporters for CI systems. Version 3 is a normal compiled library with several headers rather than the single header of version 2, and integrates with CMake. It is free and open source under the Boost Software License 1.0.

Problems it solves

  • write unit tests for a C++ project with readable assertions
  • benchmark a small C++ function inside the test suite
  • run C++ tests in CI and get results in a format it understands

Features

  • Free-form test names
  • Natural C++ boolean assertions
  • Sections for shared set-up and tear-down
  • Micro-benchmarks
  • BDD-style macros
  • Matchers and generators
  • CMake integration
  • Reporters for CI

Alternatives

The same job

These do what Catch2 does.

  1. GoogleTest Google's C++ testing and mocking framework

Compare Catch2 with the top 3