Proptest
Hypothesis-inspired property testing for Rust with automatic shrinking to minimal failing cases.
Repository Health
Technical Analysis
Proptest is a property-based testing framework for Rust in the QuickCheck family, inspired by Python’s Hypothesis. Rather than writing example-based tests, you assert that properties of your code hold for arbitrary generated inputs; when Proptest finds a counterexample, it automatically shrinks it to the minimal case that still reproduces the failure.
Unlike classic QuickCheck, Proptest defines value generation and shrinking on a per-value ‘strategy’ basis rather than per type, which makes composing complex input generators far more flexible. It ships strategies for primitives, collections, strings (including regex-driven generation), and custom types, plus a macro-based DSL for writing tests concisely.
What You Get
- The
proptest!macro DSL for concise property tests - A rich library of strategies for primitives, collections, and strings
- Automatic shrinking of counterexamples to minimal reproductions
- Regex-based and custom value generation via composable strategies
- Failure persistence so discovered cases are re-checked over time
Common Use Cases
- Verifying invariants and round-trip properties (encode/decode, serialize/deserialize)
- Fuzzing parsers and data structures with structured random input
- Finding edge cases that example-based unit tests miss
- Generating complex, valid test data via composed strategies
Under The Hood
Architecture - The core proptest crate is organized by the values it can generate: num.rs, bool.rs, char.rs, string.rs, collection.rs, tuple.rs, option.rs, and result.rs each define strategies, unified by the strategy/ module’s Strategy trait and combinators. The test_runner/ drives execution — sampling from strategies, detecting failures, and orchestrating shrinking — while sugar.rs/macros.rs provide the proptest! DSL and arbitrary/ supplies default strategies per type. Companion workspace crates (proptest-derive, proptest-macro, proptest-state-machine) layer derivation and stateful testing on top.
Tech Stack - Pure Rust (edition-modern, MSRV 1.86), structured as a Cargo workspace. It leans on small focused dependencies (e.g. bit-set, bit-vec, regex tooling for string generation) and supports no_std-style facades via std_facade.rs.
Code Quality - Proptest is a mature, feature-complete framework under active maintenance, with an extensive book, a detailed CHANGELOG, prerelease check scripts, and a Nix flake for reproducible builds. The per-value strategy design keeps generation and shrinking logic cohesive, and the codebase is broadly used and battle-tested across the Rust ecosystem.
API Design - The API is a strong point: the proptest! macro reads almost like a plain test while strategies compose fluently through combinators like prop_map, prop_filter, and prop_flat_map. The comprehensive book and per-value model make intermediate use approachable, though mastering custom strategies and shrinking behavior carries a moderate learning curve.
Used by 5 apps in this directory
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
ParadeDB
Search · Databases · Analytics
Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.
PostHog
Analytics · Monitoring · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.