All Projects → doctest → doctest

doctest / doctest

Licence: MIT license
The fastest feature-rich C++11/14/17/20 single-header testing framework

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to doctest

Doctest
The fastest feature-rich C++11/14/17/20 single-header testing framework
Stars: ✭ 3,568 (-19.53%)
Mutual labels:  unit-testing, tdd, doctest, testing-framework, cpp20
Ut
UT: C++20 μ(micro)/Unit Testing Framework
Stars: ✭ 507 (-88.57%)
Mutual labels:  unit-testing, tdd, testing-framework
Awesome Unit Testing Swift
A curated collection of awesome blog articles, books, talks, podcasts, tools/frameworks and examples.
Stars: ✭ 272 (-93.87%)
Mutual labels:  unit-testing, tdd, testing-framework
tau
A Micro (1k lines of code) Unit Test Framework for C/C++
Stars: ✭ 121 (-97.27%)
Mutual labels:  unit-testing, testing-framework, cpp20
Enzyme Matchers
Jasmine/Jest assertions for enzyme
Stars: ✭ 881 (-80.13%)
Mutual labels:  unit-testing, tdd
Quixote
CSS unit and integration testing
Stars: ✭ 788 (-82.23%)
Mutual labels:  unit-testing, tdd
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (-99.08%)
Mutual labels:  unit-testing, testing-framework
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-97.63%)
Mutual labels:  unit-testing, testing-framework
Autoparams
Arbitrary test data generator for parameterized tests in Java inspired by AutoFixture.
Stars: ✭ 77 (-98.26%)
Mutual labels:  unit-testing, tdd
Fast Check
Property based testing framework for JavaScript (like QuickCheck) written in TypeScript
Stars: ✭ 2,604 (-41.27%)
Mutual labels:  unit-testing, tdd
Quiz App
A repository reflecting the progress made on the "How to Build iOS Apps with Swift, TDD & Clean Architecture" YouTube series, by Caio & Mike.
Stars: ✭ 230 (-94.81%)
Mutual labels:  unit-testing, tdd
Pgtap
PostgreSQL Unit Testing Suite
Stars: ✭ 631 (-85.77%)
Mutual labels:  unit-testing, testing-framework
Deepstate
A unit test-like interface for fuzzing and symbolic execution
Stars: ✭ 603 (-86.4%)
Mutual labels:  unit-testing, testing-framework
Sinon
Test spies, stubs and mocks for JavaScript.
Stars: ✭ 8,828 (+99.1%)
Mutual labels:  unit-testing, tdd
Jasmine Matchers
Write Beautiful Specs with Custom Matchers for Jest and Jasmine
Stars: ✭ 552 (-87.55%)
Mutual labels:  unit-testing, tdd
Js Unit Testing Guide
📙 A guide to unit testing in Javascript
Stars: ✭ 1,346 (-69.64%)
Mutual labels:  unit-testing, tdd
Transport Eta
Twitch streamed 🎥playground repo, README speaks to you.
Stars: ✭ 223 (-94.97%)
Mutual labels:  unit-testing, tdd
Alsatian
TypeScript testing framework with test cases
Stars: ✭ 244 (-94.5%)
Mutual labels:  unit-testing, tdd
Bach
Bach Testing Framework
Stars: ✭ 392 (-91.16%)
Mutual labels:  unit-testing, testing-framework
Bash unit
bash unit testing enterprise edition framework for professionals
Stars: ✭ 419 (-90.55%)
Mutual labels:  unit-testing, tdd

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) 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.

Standard License download CII Best Practices Language grade: C/C++ Chat - Discord Try it online

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

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 and writing thousands of asserts
  • Doesn't produce any warnings even on the most aggressive warning levels for MSVC/GCC/Clang
  • Can remove everything testing-related from the binary with the DOCTEST_CONFIG_DISABLE identifier
  • thread-safe - asserts can be used from multiple threads spawned from a single test case - example
  • asserts can be used outside of a testing context - as a general purpose assert library - example
  • No global namespace pollution (everything is in doctest::) & doesn't drag any headers with it
  • 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

cost-of-including-the-framework-header

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.

doctest is modeled after Catch and some parts of the code have been taken directly - check out the differences.

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

Documentation

Project:

Usage:

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 page.

Stargazers over time

Stargazers over time

Logo

The logo is licensed under a Creative Commons Attribution 4.0 International License. Copyright © 2019 area55git   License: CC BY 4.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].