catch2-with-gmock VS Catch

Compare catch2-with-gmock vs Catch and see what are their differences.

catch2-with-gmock

Exmaple of using Catch2 with GMock (by matepek)

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) (by catchorg)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
catch2-with-gmock Catch
1 55
13 17,941
- 0.8%
10.0 9.2
almost 4 years ago 5 days ago
C++ C++
MIT License Boost Software License 1.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

catch2-with-gmock

Posts with mentions or reviews of catch2-with-gmock. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-19.
  • Unit testing and mocking for c++
    6 projects | /r/cpp | 19 Oct 2021
    I'm answering a question asked not from me. I've used both Google.Test and Catch2 and latter one feels much nicer. Sections from Catch2 just do not exist in other frameworks however they are super powerful. It has drawbacks like not having out of the box macros for setting up stuff once for all the runs of a test before a test is run with various parameters. See https://github.com/catchorg/Catch2/issues/1602 Integrating gmock should be easy as I've seen but not flawless. As I remember some extra work needs to be done so expectations are verified at end of sections? See https://github.com/matepek/catch2-with-gmock Google.Test doesn't support (or at least didn't when I last looked) some combination of type and value generators. Other than that, the slightly uglier syntax and lack of sections (which is pretty big) it's all good. Especially with gmock all integrated and delivered to you in one package.

Catch

Posts with mentions or reviews of Catch. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-05.
  • How can I check the execution time of a program rendered in SFML?
    3 projects | /r/cpp_questions | 5 Dec 2023
    https://github.com/catchorg/Catch2 (for unit testing, need to do timing yourself)
  • `DestroyJavaVM()` failing on OpenJ9?
    2 projects | /r/javahelp | 22 Apr 2023
    ```c++ // https://github.com/catchorg/Catch2/tree/Catch1.x // https://github.com/philsquared/Catch/releases/download/v1.12.2/catch.hpp
  • How do you use the Catch testing library?
    4 projects | /r/cpp_questions | 9 Apr 2023
    Include(FetchContent) FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.3.2 ) FetchContent_MakeAvailable(Catch2)
    4 projects | /r/cpp_questions | 9 Apr 2023
    set(CATCH_VERSION "" CACHE STRING "") Include(FetchContent) FetchContent_Declare(Catch2 URL https://github.com/catchorg/Catch2/archive/refs/tags/v${CATCH_VERSION}.tar.gz ) FetchContent_MakeAvailable(Catch2) target_link_libraries( Catch2::Catch2)
  • Trying to add tests for my cmake for catch2 with ctest.
    2 projects | /r/cmake | 27 Feb 2023
    Another possible issue would be the include(Catch) in your root cmakelists.txt . To include Catch there it must be part of your module path. Otherwise you have to include the path to that catch2 cmake file. Here is that file in their repository - https://github.com/catchorg/Catch2/blob/devel/extras/Catch.cmake . I recon that CMake doesn't know about this file since you call find_package(Catch2 REQUIRED) later in your subdirectory
  • Seeking Improve Advice on my C++ Network Library
    7 projects | /r/cpp | 6 Feb 2023
    Unit test coverage by Catch2 framework.
  • snitch v1.0 -- A lightweight C++20 testing framework
    4 projects | /r/cpp | 16 Jan 2023
    Looks good but currently at least REQUIRE (most likely all the other checks too but I didn't test that) fails to correctly evaluate some expressions, due to fundamental problems with macros. One example is described in this issue of the Catch2 repository.
  • IDE for CPP(leetcode)
    4 projects | /r/cpp_questions | 3 Jan 2023
    However, you can use a unit test framework like GoogleTest or Catch2 whic creates a main() function for you which allows you to run single functions, as long as they have been created through some preprocessor macros. Then you can use a VS Code test adapter like this or this which may let you run a single test by right clicking it directly in VS Code.
  • CPM.cmake to make CMake's FetchContent easier
    4 projects | dev.to | 28 Dec 2022
    include(FetchContent) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.0.0-preview4 ) FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git GIT_TAG 9.1.0 ) FetchContent_Declare( scnlib GIT_REPOSITORY https://github.com/eliaskosunen/scnlib.git GIT_TAG v1.1.2 ) FetchContent_MakeAvailable(Catch2 fmt scnlib)
  • New to C++
    2 projects | /r/cpp | 20 Dec 2022
    Make sure you write unit tests, I use gtest but catch2 is also good.

What are some alternatives?

When comparing catch2-with-gmock and Catch you can also consider the following projects:

Google Test - GoogleTest - Google Testing and Mocking Framework

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

Boost.Test - The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)

FakeIt - C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.

CppUTest - CppUTest unit testing and mocking framework for C/C++

Google Mock

trompeloeil - Header only C++14 mocking framework

CppUnit - C++ port of JUnit

benchmark - A microbenchmark support library

Unity Test API - Simple Unit Testing for C

UnitTest++ - A lightweight unit testing framework for C++

fff - A testing micro framework for creating function test doubles