Property-based testing
Property-based testing is a software-testing technique that checks whether specified general properties hold across varied, often automatically generated, inputs.
Functional Programming in Scala, Second Edition
Property-based testing checks general behavioral properties against automatically generated input values rather than relying only on hand-written examples.
- How it is used
- Specifies API laws and behavioral invariants while generators supply test cases automatically.
- How deep it goes
- Develops a testing library through generators, properties, combinators, result statuses, and exhaustive generation.
- Examples
- Uses list reversal, sum, maximum, sorting, Boolean conjunction, and parallel-computation laws as properties.
- What you can do after
- Build it from scratch with generators and properties that report falsifications, passes, or proofs.
Read how Functional Programming in Scala, Second Edition explains property-based testing →
Functional Design and Architecture: Examples in Haskell
Property-based testing evaluates software by checking general behavioral properties across automatically generated inputs rather than relying only on hand-written example cases.
- How it is used
- Checks behavioral invariants across generated inputs, particularly for small pure algorithms, as part of functional testing.
- How deep it goes
- Explains property selection, generated cases and shrinking, then works through pure and effectful tests while noting coverage limits.
- Examples
- Illustrates malformed square functions and a randomly generated labyrinth whose dimensions are checked.
- What you can do after
- Apply it via QuickCheck to encode properties, run generated cases and interpret counterexamples without treating a passing run as proof.
Read how Functional Design and Architecture: Examples in Haskell explains property-based testing →
Vibe Engineering
A testing technique that checks general properties or invariants across many generated or varied inputs rather than only fixed examples.
- How it is used
- Probes core logic and untrusted inputs adversarially, including when AI-generated code needs verification beyond happy-path tests.
- How deep it goes
- Works through generated parser properties and their assumptions, then defers system integration behavior to contracts and integration tests.
- Examples
- Tests a markup parser for determinism, plain-text preservation, tag balance, line independence, and link-count preservation.
- What you can do after
- Apply it via Hypothesis to generate parser inputs and investigate whether failures expose implementation bugs or incorrect property assumptions.
Learn Haskell by Example
Property testing checks whether program behavior satisfies general properties across automatically generated or varied inputs.
- How it is used
- Tests pure functional code by checking formalized behavior across randomly generated inputs.
- How deep it goes
- Builds a generic random-test action, then explains QuickCheck generators, properties, shrinking, and automatic collection.
- Examples
- Uses sorted lists, ROT13 symmetry, and alphabet-rotation closure with a constrained generator.
- What you can do after
- Apply it via QuickCheck to write properties, generate inputs, shrink failures, and run collected checks.
Read how Learn Haskell by Example explains property-based testing →
Functional Programming in JavaScript
A testing approach that checks whether a program satisfies general properties across many generated inputs rather than only fixed example cases.
- How it is used
- Uses generated cases to test functional specifications and expose failures that fixed unit-test examples may miss.
- How deep it goes
- Explains properties, generators, verdicts, reports, custom specifiers, and QUnit integration through JavaScript examples.
- Examples
- Demonstrates grade classification, generated Social Security numbers, pass reports, invalid properties, and QUnit integration.
- What you can do after
- Apply it via JSCheck to generate randomized inputs, evaluate function properties, and inspect pass or failure reports.
Read how Functional Programming in JavaScript explains property-based testing →
100 Java Mistakes and How to Avoid Them
Property-based testing verifies general behavioral properties by running tests against many generated inputs, often including randomized inputs.
- How it is used
- Uses generated behavior to discover bugs without writing a separate unit test for every input.
- How deep it goes
- Explains generation, property checking, replay, and sequence reduction, but stops short of guaranteeing every bug is found.
- Examples
- Tests unexpected exceptions, mutation by read-only operations, and comparator ordering using randomized objects and large sorted datasets.
- What you can do after
- Diagnose/debug reproducible failures with replayed and minimized operation sequences, using jqwik for Java property tests.
Read how 100 Java Mistakes and How to Avoid Them explains property-based testing →
The Coder Cafe
Property-based testing is a software testing technique that generates many inputs to verify general properties that outputs or behavior must satisfy.
- How it is used
- Finds edge cases missed by manually chosen tests by checking general rules against generated inputs.
- How deep it goes
- Defines properties, contrasts PBT with fuzzing, and surveys function-to-system-level invariants without giving a step-by-step implementation.
- Examples
- Uses positive-number addition, generated strings, balanced transactions, and duplicate-free retries as example properties.
- What you can do after
- Practice/perform it by defining a property, generating varied inputs, and checking for violations at function or system level.
Functional Programming in C#, Second Edition
A property-based test checks a general property across generated or supplied input values.
- How it is used
- Checks whether implementations satisfy general properties or laws across generated inputs.
- How deep it goes
- Demonstrates a property test and custom generator, while deferring detailed discussion of the four underlying applicative laws.
- Examples
- Tests an Option applicative equality using multiplication, first with generated integers and then with generated Some and None values.
- What you can do after
- Apply it via FsCheck to write a property and register a custom input generator.
Read how Functional Programming in C#, Second Edition explains property-based testing →
Automating API Delivery
Property-based testing is a technique that generates many test cases from specified data properties or input strategies.
- How it is used
- Validates live APIs against OpenAPI definitions through generated requests, fuzzing, and schema checks.
- How deep it goes
- Explains CLI execution, data generation, request recording, examples, and interpreting schema failures.
- Examples
- Uses a Product Catalog API, an OpenAPI definition, generated UUID requests, cassette.yaml, and unexpected response properties.
- What you can do after
- Diagnose API schema mismatches and reproduce generated requests from recorded cassettes.
Read how Automating API Delivery explains property-based testing →
F# in Action: A Revised Edition of Get Programming with F#
A property-based test is an individual automated test that evaluates one or more stated properties over generated inputs.
- How it is used
- Uses generated inputs and behavioral properties to increase confidence when conventional unit tests cover too few cases.
- How deep it goes
- Explains generated-input testing and a flipCase example, but does not specify the individual properties or their implementation.
- Examples
- Contrasts a Hello test for flipCase with progressively generated strings governed by input-output properties.
- What you can do after
- Apply it via FsCheck to test behavioral rules across many generated inputs.
Code Like a Pro in Rust
Property-based testing is a software-testing technique that generates many inputs to check whether general properties hold.
- How it is used
- Improves unit testing by generating random inputs and checking general properties.
- How deep it goes
- Explains proptest usage, minimal failing cases, CPU tradeoffs, and overflow behavior; stops short of exhaustive input coverage.
- Examples
- Uses a generic Rust adder to expose signed-integer overflow and demonstrate wrapping arithmetic.
- What you can do after
- Apply it via proptest to generate inputs, verify properties, and isolate minimal failing cases.
Read how Code Like a Pro in Rust explains property-based testing →
Also covered in
What to know first
- pure functionA pure function is a function whose result depends only on its explicit inputs and whose evaluation has no externally observable side effects.
- contractA contract is an agreed specification of the conditions, expectations, rights, or obligations that govern behavior or interactions between parties or software components.
- edge caseAn edge case is an unusual or boundary condition in a system’s expected domain that may produce behavior different from ordinary cases.
- predicateA predicate is a condition or relation over values or entities that specifies whether a stated property holds.
Related concepts
- FsCheckused by · FsCheck is a .NET property-based testing library that generates input values and checks whether specified properties hold for them.
- QuickCheckused by · QuickCheck is a property-based testing library, originally developed for Haskell, that generates test cases to check specified properties and can shrink failures to simpler counterexamples.
- forallused by · forall is a property-testing combinator that constructs a property by applying a predicate to values generated from specified generators.
- parameterized testingkind of · Parameterized testing runs the same test logic against multiple sets of supplied input values or parameters.
- invariantuses · An invariant is a condition or property that must remain true across the specified valid states, operations, or transformations of a system or computation.
- software testingcontrasts with · Software testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
Questions about property-based testing
What is property-based testing?
Property-based testing is a software-testing technique that checks whether specified general properties hold across varied, often automatically generated, inputs.
Which Manning books explain property-based testing?
Functional Programming in Scala, Second Edition, Functional Design and Architecture: Examples in Haskell, Vibe Engineering, Learn Haskell by Example, Functional Programming in JavaScript, 100 Java Mistakes and How to Avoid Them, The Coder Cafe, Functional Programming in C#, Second Edition and 3 more.
What should I know before learning property-based testing?
Manning books that teach property-based testing usually introduce pure function, contract, edge case and predicate first.
What is the difference between property-based testing and software testing?
Property-based testing is a software-testing technique that checks whether specified general properties hold across varied, often automatically generated, inputs. Software testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
What is property-based testing a kind of?
Property-based testing is a kind of parameterized testing. Parameterized testing runs the same test logic against multiple sets of supplied input values or parameters.
What is property-based testing also called?
Property-based testing is also called property testing, property-based test or property test.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










