Freedom report

Two barsScore 5.6

  • Free tierNo free tier on record
  • Open codeNo open-source code on record
  • Runs widely3 of 6 device platforms
  • DocumentedPlans, terms and facts published

Hypothesis is a free Python library for property-based testing. A developer describes behavior that code should meet, and the library generates inputs—including edge cases—to explore whether those properties hold. Strategies define and combine the data a test should use. When Hypothesis finds a failure, it reports an example and tries to simplify it; failing examples are stored in a local test database for replay in later runs. Tests execute as ordinary Python functions inside pytest, unittest, nose, or another framework able to run a Python function. Hypothesis is not itself a test runner. Rule-based state machines can generate sequences of operations for tests of stateful systems and objects. By default, it generates 100 random inputs per test, a count that can be adjusted with max_examples. The project says it works and is regularly tested on Linux, macOS, Windows, and Emscripten, and supports CPython and PyPy 3.10 and later. First-party extras include integrations for specific packages, with Django given as a documented example. The project supports only its most recent version; undocumented behavior may change even in patch releases.

Who it is for

It suits Python developers who want tests to explore generated inputs and edge cases rather than rely only on hand-picked examples. It is especially relevant to people testing properties or stateful behavior within an existing test framework.

What is good

  • Generates inputs including edge cases
  • Simplifies failing examples
  • Stores failures for replay
  • Supports pytest and unittest
  • Can generate stateful operation sequences

What to know first

  • Not a test runner itself
  • Supports only the most recent version
  • Undocumented behavior may change in patch releases

Verdict

Hypothesis adds generated-input property testing to an existing Python test framework, with failure reduction and replay. Users should account for its version policy and the need for a separate test runner.

Compared on property-based testing tools

Free plan
Yes
Supported languages
Python
Test runner support
pytest, unittest
Failing-case shrinking
Yes
Stateful testing
Yes
Reproducible failures
Yes

Best Hypothesis alternatives

See all 20