doctest alternatives and similar libraries
Based on the "Debug" category.
Alternatively, view doctest alternatives based on common mentions on social networks and blogs.
-
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)
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of doctest or a related project?
README
master branch dev branch
doctest is a new C++ testing framework but is by far the fastest both in compile times (by [orders of magnitude](doc/markdown/benchmarks.md)) and runtime compared to other feature-rich alternatives. It brings the ability of compiled languages such as D / Rust / Nim to have tests written directly in the production code thanks to a fast, transparent and flexible test runner with a clean interface.
The framework is and will stay free but needs your support to sustain its development. There are lots of new features and maintenance to do. If you work for a company using doctest or have the means to do so, please consider financial support. Monthly donations via Patreon and one-offs via PayPal.
A complete example with a self-registering test that compiles to an executable looks like this:
[cover-example](scripts/data/using_doctest_888px_wide.gif)
There are many C++ testing frameworks - Catch, Boost.Test, UnitTest++, cpputest, googletest and others.
The key differences between it and other testing frameworks are that it is light and unintrusive:
- Ultra light on compile times both in terms of [including the header](doc/markdown/benchmarks.md#cost-of-including-the-header) and writing [thousands of asserts](doc/markdown/benchmarks.md#cost-of-an-assertion-macro)
- Doesn't produce any warnings even on the [most aggressive](scripts/cmake/common.cmake#L84) warning levels for MSVC/GCC/Clang
- Can remove everything testing-related from the binary with the [
DOCTEST_CONFIG_DISABLE
](doc/markdown/configuration.md#doctest_config_disable) identifier - [thread-safe](doc/markdown/faq.md#is-doctest-thread-aware) - asserts can be used from multiple threads spawned from a single test case - [example](examples/all_features/concurrency.cpp)
- asserts can be used [outside of a testing context](doc/markdown/assertions.md#using-asserts-out-of-a-testing-context) - as a general purpose assert library - [example](examples/all_features/asserts_used_outside_of_tests.cpp)
- No global namespace pollution (everything is in
doctest::
) & doesn't drag any headers with it - [Portable](doc/markdown/features.md#extremely-portable) C++11 (use tag 1.2.9 for C++98) with over 100 different CI builds (static analysis, sanitizers..)
- binaries (exe/dll) can use the test runner of another binary => tests in a single registry - [example](examples/executable_dll_and_plugin/)
[cost-of-including-the-framework-header](scripts/data/benchmarks/header.png)
This allows the framework to be used in more ways than any other - tests can be written directly in the production code!
Tests can be a form of documentation and should be able to reside near the production code which they test.
- This makes the barrier for writing tests much lower - you don't have to: 1) make a separate source file 2) include a bunch of stuff in it 3) add it to the build system and 4) add it to source control - You can just write the tests for a class or a piece of functionality at the bottom of its source file - or even header file!
- Tests in the production code can be thought of as documentation/up-to-date comments - showcasing the APIs
- Testing internals that are not exposed through the public API and headers is no longer a mind-bending exercise
- Test-driven development in C++ has never been easier!
The framework can be used just like any other without mixing production code and tests - check out the [features](doc/markdown/features.md).
doctest is modeled after Catch and some parts of the code have been taken directly - check out [the differences](doc/markdown/faq.md#how-is-doctest-different-from-catch).
This table compares doctest / Catch / lest which are all very similar.
Checkout the CppCon 2017 talk on YouTube to get a better understanding of how the framework works and read about how to use it in the JetBrains article - highlighting the unique aspects of the framework! On a short description on how to use the framework along production code you could refer to this GitHub issue. There is also an older article in the february edition of ACCU Overload 2017.
[CppCon 2017 talk about doctest on youtube](scripts/data/youtube-cppcon-talk-thumbnail.png)
Documentation
Project:
- [Features and design goals](doc/markdown/features.md) - the complete list of features
- Community driven roadmap - upcoming features
- [Benchmarks](doc/markdown/benchmarks.md) - compile-time and runtime supremacy
- [Contributing](CONTRIBUTING.md) - how to make a proper pull request
- [Changelog](CHANGELOG.md) - generated changelog based on closed issues/PRs
Usage:
- [Tutorial](doc/markdown/tutorial.md) - make sure you have read it before the other parts of the documentation
- [Assertion macros](doc/markdown/assertions.md)
- [Test cases, subcases and test fixtures](doc/markdown/testcases.md)
- [Parameterized test cases](doc/markdown/parameterized-tests.md)
- [Command line](doc/markdown/commandline.md)
- [Logging macros](doc/markdown/logging.md)
- [
main()
entry point](doc/markdown/main.md) - [Configuration](doc/markdown/configuration.md)
- [String conversions](doc/markdown/stringification.md)
- [Reporters](doc/markdown/reporters.md)
- [Extensions](doc/markdown/extensions.md)
- [FAQ](doc/markdown/faq.md)
- [Build systems](doc/markdown/build-systems.md)
- [Examples](examples)
Contributing
Support the development of the project with donations! There is a list of planned features which are all important and big - see the roadmap.
If you work for a company using doctest or have the means to do so, please consider financial support.
Contributions in the form of issues and pull requests are welcome as well - check out the [Contributing](CONTRIBUTING.md) page.
Stargazers over time
Logo
The [logo](scripts/data/logo) is licensed under a Creative Commons Attribution 4.0 International License. Copyright © 2019 area55git
*Note that all licence references and agreements mentioned in the doctest README section above
are relevant to that project's source code only.