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)
doctest
The fastest feature-rich C++11/14/17/20/23 single-header testing framework (by doctest)
Catch | doctest | |
---|---|---|
57 | 20 | |
18,792 | 5,981 | |
0.8% | 1.7% | |
8.9 | 0.0 | |
20 days ago | 10 days ago | |
C++ | C++ | |
gtkbook License | MIT License |
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.
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.
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 2024-10-17.
-
Unit Tests as Documentation
This is one area where a BDD style framework like catch2[0] really shines, IMO. The way tests are written in this style naturally lends itself to self-documenting each branch
[0]: https://github.com/catchorg/Catch2
-
Comparing C++ range libraries for filter+reverse case with non-trivial lambda
The code uses catch2 to test for correctness and performance. Catch2 is a unit testing framework for C++, but it also provides basic micro-benchmarking features. Unfortunately, it doesn't provide any way to visualise the results, so I created a script and submitted PR adding plotting capabilities to Catch.
- C++ Comparison Operator Craziness
-
How can I check the execution time of a program rendered in SFML?
https://github.com/catchorg/Catch2 (for unit testing, need to do timing yourself)
- Semi crise existentielle de développeur
-
`DestroyJavaVM()` failing on OpenJ9?
```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?
Include(FetchContent) FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.3.2 ) FetchContent_MakeAvailable(Catch2)
- Tracking the Fake GitHub Star Black Market
- The Little Things: Why you should always have benchmarks ready
-
Trying to add tests for my cmake for catch2 with ctest.
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
doctest
Posts with mentions or reviews of doctest.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2024-11-24.
-
The Two Factions of C++
catch2 has become fairly bloated. doctest takes all of the best parts of catch2 without all the bloat and the end result is a test framework that is literally over 10x faster than catch2. It's also like 90% compatible with catch2 so porting your tests to it is pretty easy.
Especially if you have a build process that always runs your unit tests, it's nice to have a very fast test/compile/debug loop.
https://github.com/doctest/doctest
-
Unit testing tool suggestions
I have never used "tools" for unit-tests, only web sites that show the results of the tests or code coverage. For C++ I prefer https://github.com/doctest/doctest but most companies I worked for use Catch2.
-
Question about Doctest.h
Do the README and tutorial not explain it well enough? It's a framework for automated unit testing.
- Doctest – C++ Testing Framework
-
Memory Safety in the D Programming Language (Part 2 of N)
This is, honestly, super easy to get going. Nowadays you have a ton of libraries and more-than-decent build systems. With Meson/CMake and Conan/Vcpkg I can set up a project with testing in 3 minutes. Also, I think that at the end of the day you want your tests to live somewhere else. But if you want to embed them, you also have https://github.com/doctest/doctest.
-
how can I improve my connect4 board class?
Write some tests. They can find bugs early and give you confidence that your code works so far. That doesn't have to be anything fancy, e.g. with doctest:
-
Testing framework Catch2 3.0 final released
Keep in mind https://github.com/doctest/doctest/issues/554. Also, doctest lacks: - Matchers - Data generators - Benchmarking - ...
-
Check if my code meets the requirements?
Your requirements can easily simulated on paper (like increase the speed once, twice, ...), then translated to unit-tests with a framework like https://github.com/doctest/doctest.
- The Lisp Curse
-
C++17 python like print function
For stuff like this which is very easy to test (very predefined input vs output), I highly suggest using some testing framework. Catch2 is great, but there is also doctest and good ole googletest. If you do this, it would also be a great intro to CI, where you do some plumbing on github or gitlab where every commit causes a build to happen on their servers and run through the unit tests, and if it passes it gets merged into master.
What are some alternatives?
When comparing Catch and doctest you can also consider the following projects:
Google Test - GoogleTest - Google Testing and Mocking Framework
Boost.Test - The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
Google Mock
CppUTest - CppUTest unit testing and mocking framework for C/C++
CppUnit - C++ port of JUnit
Unity Test API - Simple Unit Testing for C
benchmark - A microbenchmark support library