Hypothesis

C
C tier on Property-Based Testing ToolsScore 6.6 · #6 of 27
Android app
Not listed
Free plan
No
Runs on
Linux, Mac, Windows
hypothesis.works
The Hypothesis homepage

Summary

Hypothesis is a free Python library for property-based testing. Instead of checking only examples chosen in advance, you describe behavior your code should satisfy and the library generates inputs—including edge cases—to explore those properties. Its strategies let you define and combine the kinds of data tests should use. When Hypothesis finds a failure, it reports an example and tries to reduce it to a simpler case; it saves failures in a local test database so they can be replayed in later runs. Tests run as regular Python functions inside a framework such as pytest or unittest, or another framework able to run a Python function. Hypothesis is not a test runner. It can also use rule-based state machines to generate operation sequences for testing stateful systems and objects. The default is 100 generated inputs per test, adjustable with max_examples. The project says it works on Linux, macOS, Windows and Emscripten, and supports CPython and PyPy 3.10 and later.

Who it is for

Hypothesis suits Python developers who want to specify acceptable behavior and let generated inputs probe their code. It is useful when tests need reproducible failures or sequences for stateful behavior.

What is good

  • Generates inputs including edge cases.
  • Attempts to simplify failing examples.
  • Stores failures for replay in later runs.
  • Supports pytest and unittest.
  • State machines generate operation sequences.

What to know first

  • It is not a test runner.
  • Supports Python only.
  • Only the most recent version is supported.

Everything Xiaomi review

Hypothesis: the full review

Hypothesis adds generated-input testing to an existing Python test framework, with saved failures and tools for stateful cases. Choose it if you want tests to explore beyond hand-picked examples; it does not replace your test runner.

Overview

Hypothesis is for Python developers who want tests to explore inputs beyond a hand-picked set of examples. Its generated cases, failure simplification and replay make property-based testing practical within a familiar test framework.

It is a focused testing library, not a complete testing environment: you still need a runner and must describe the behavior your code should satisfy.

Key features

Strategies and generated cases

Strategies define and compose the data a test can receive, letting you check a stated property against varied inputs, including edge cases. Hypothesis generates 100 random inputs per test by default; the max_examples setting lets you control that count. This gives a test broader reach than a fixed example set, though the cases depend on the properties and data you choose to describe.

Failures you can investigate and replay

When a generated input exposes a bug, Hypothesis reports it and tries to simplify the failing example. That can make an unexpected failure easier to diagnose than a complex input you assembled by hand. It also saves failing examples in a local test database and replays them on later runs, helping prevent a discovered problem from disappearing into a one-off run.

Framework and stateful testing

Hypothesis tests are ordinary Python functions, so they can run under pytest, unittest, nose or another framework that runs Python functions. First-party extras integrate with particular packages; Django is one example. For systems whose behavior depends on operation order, rule-based state machines generate sequences of operations against stateful objects. Hypothesis itself is not a runner, so it fits teams that already have a Python test setup rather than those seeking an all-in-one testing tool.

As of version 6.136.9, the same test can run simultaneously from multiple threads. The project says it regularly tests compatibility with CPython and PyPy 3.10 and later. It supports macOS, Windows, Linux and Emscripten, although the listed platforms for this entry are Linux, macOS and Windows.

Pricing

Hypothesis is free, with a free plan and no paid tier described. That makes it straightforward to adopt for individual developers or teams, but the project’s development model is not a promise of a long-term release schedule: maintainers say new features need sponsorship or implementation by someone else, and there is no long-term release plan.

New packages are published to PyPI after changes are merged, usually within half an hour. The project supports the most recent Hypothesis version; documented APIs are not expected to break except between major version bumps, while undocumented behavior can change in patch releases. Teams relying on undocumented behavior should account for that compatibility boundary.

Platforms

Hypothesis is a Python library for Linux, macOS and Windows. The project also reports regular testing on Emscripten. It is not a cross-language choice: Python is its supported language.

Who it's for

Choose Hypothesis if you write Python tests and want to express acceptable behavior once, then have generated inputs probe it for edge cases. It is especially useful when a system has stateful behavior that can be exercised through sequences of operations, or when preserving and simplifying failures would help your debugging process.

Look elsewhere if you need a test runner rather than a library, or if your codebase uses a language other than Python. Its help channels include the python-hypothesis tag on Stack Overflow and a mailing list.

Pros and cons

  • Broader input exploration: Composable strategies and generated cases can expose edge cases absent from manually chosen examples.
  • Actionable failures: Shrinking and local replay make generated bugs easier to inspect and keep in the test cycle.
  • Fits existing Python tests: Support for common runners means adoption does not require replacing the test framework.
  • Requires a runner and property descriptions: Hypothesis does not execute tests on its own, and generated coverage depends on the behavior and input strategies you define.
  • Python-only, current-version support: Other languages need another tool, and users are expected to use the latest Hypothesis release.

Alternatives

For other language ecosystems, these free property-testing tools may fit better:

  • Gopter is a free, MIT-licensed Go property-testing library for Linux and self-hosted use; choose it for Go rather than Python.
  • RapidCheck is a free alternative for Linux, self-hosted and Windows platforms.
  • fast-check is a free, MIT-licensed JavaScript/TypeScript project for API, Linux and web platforms; choose it for those languages instead of Python.
  • Proptest is a free alternative listed for web use.
  • QuickCheck is a free Haskell library for random testing of program properties on Linux; it is the language-specific choice for Haskell.
  • Rapid is a free, open-source Go library with no dependencies outside Go’s standard library, for self-hosted use.
  • SwiftCheck is a free option for macOS and iOS.
  • CsCheck is another free alternative.

Browse the Property-Based Testing Tools list for more options.

Verdict

Hypothesis is a strong fit for Python developers who want tests to discover, simplify and preserve surprising inputs without changing their runner. Its biggest advantage is that complete cycle from generated case to replayable failure; its main limitation is the same focus that makes it effective: it is a Python testing library, not a runner or a cross-language solution.

Compared on property-based testing tools

Free plan
Yeshypothesis.works
Supported languages
Pythonhypothesis.works
Test runner support
pytest, unittesthypothesis.works
Failing-case shrinking
Yeshypothesis.works
Stateful testing
Yeshypothesis.works
Reproducible failures
Yeshypothesis.works

Facts

What it does
Hypothesis is a property-based testing library for Python that generates inputs, including edge cases, to test properties you describe.hypothesis.works · 28 Sept 2026
Simplifies failures
When Hypothesis finds a bug, it reports a failing example and tries to simplify it.hypothesis.works · 28 Sept 2026
Test framework support
Hypothesis works with pytest, unittest, nose, or another framework that can run a Python function.hypothesis.works · 28 Sept 2026
Data generation
Its strategies let users describe and compose the kinds of data their tests should generate.hypothesis.works · 28 Sept 2026
Repeatable failures
Hypothesis saves failing examples in a local test database so it can replay them when tests run again.hypothesis.works · 28 Sept 2026
Test runner limitation
Hypothesis is not itself a test runner; it works inside a user's normal testing framework.hypothesis.works · 28 Sept 2026
Thread safety
As of version 6.136.9, Hypothesis supports running the same test simultaneously from multiple threads.hypothesis.works · 28 Sept 2026
Release availability
The project describes publishing new packages to PyPI after changes are merged, usually within half an hour.hypothesis.works · 28 Sept 2026
Intended users
Hypothesis is for people writing software tests who want to describe acceptable behavior and have the computer explore inputs.hypothesis.works · 28 Sept 2026
Edge cases
Hypothesis randomly chooses inputs, including edge cases the user may not have considered.hypothesis.works · 29 Sept 2026
Test runners
Hypothesis tests can run as regular Python functions and work with pytest or unittest.hypothesis.readthedocs.io · 29 Sept 2026
Default run count
By default, Hypothesis generates 100 random inputs per test, and this count can be controlled with the max_examples setting.hypothesis.readthedocs.io · 29 Sept 2026
Integrations
First-party extras include integrations for specific packages, and the documentation gives Django as an example installable extra.hypothesis.readthedocs.io · 29 Sept 2026
Operating systems
The project says it is known to work and regularly tested on macOS, Windows, Linux, and Emscripten.hypothesis.readthedocs.io · 29 Sept 2026
Python support
Hypothesis is supported and tested on CPython and PyPy 3.10 and later.hypothesis.readthedocs.io · 29 Sept 2026
Community help
Users can ask questions using the python-hypothesis Stack Overflow tag or join the mailing list for help and discussion.hypothesis.readthedocs.io · 29 Sept 2026
Compatibility limit
The project supports only the most recent Hypothesis version; documented APIs are not expected to break except between major version bumps, while undocumented behavior may break in patch releases.hypothesis.readthedocs.io · 29 Sept 2026
Development model
The maintainers say new features must be sponsored or implemented by someone else, and the project has no long-term release plan.hypothesis.readthedocs.io · 29 Sept 2026

Best Hypothesis alternatives

See all 12

Where it ranks on Everything Xiaomi

Is Hypothesis yours?

Claim it for free: prove the domain, then correct facts, plans and screenshots. An editor reviews every change.

Sources