RapidCheck is a free C++ framework for property-based testing. It generates inputs and repeatedly runs properties to look for cases that disprove them; developers provide properties as callables passed to rc::check. Built-in generators cover common types, and combinators can be used to build custom ones. Its arbitrary-value generation includes standard types such as vectors, maps, sets, tuples, pairs, strings and chrono types. When a property fails, RapidCheck attempts to shrink the failing input and report a smaller counterexample. It also supports stateful testing by generating sequences of valid operations. Listed test-library integrations include Boost Test, Google Test, Google Mock and Catch. By default, a property passes after 100 successful tests, and that number is configurable. RapidCheck uses CMake, can be added as a subdirectory to a CMake project, and requires a C++11-compliant compiler. The project uses a BSD 2-Clause license. Its user guide is still in progress, with some parts missing, and notes that the API is not stable and may change.
Who it is for
RapidCheck is for C++ developers who want generated-input property tests, shrinking of failures or stateful testing. It requires a C++11-compliant compiler and uses CMake.
What is good
- Generates random inputs to search for failing cases.
- Shrinks failures into smaller counterexamples.
- Supports stateful testing sequences.
- Integrates with several test libraries.
- BSD 2-Clause license.
What to know first
- The user guide is incomplete.
- The API may change.
- Requires a C++11-compliant compiler.
Verdict
RapidCheck provides property-based and stateful testing with input generation and failure shrinking. Developers should account for its unfinished documentation and unstable API.
Compared on property-based testing tools
- Free plan
- Yes
- Supported languages
- C++
- Test runner support
- Boost Test, Google Test, Google Mock, Catch.hpp
- Failing-case shrinking
- Yes
- Stateful testing
- Yes
- Reproducible failures
- Yes
