Property-based testing
Property-based testing is a software-testing technique that generates varied inputs and checks whether specified general properties of the software’s behavior hold across them.
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
- Validates functional contracts by challenging invariants with generated inputs rather than only hand-written cases.
- How deep it goes
- Explains invariant encoding, random generation, shrinking, thresholds, constrained inputs, and IO-backed scenario setup; does not guarantee freedom from subtle bugs.
- Examples
- Uses squaring and malformed-square functions, plus generated labyrinth bounds under a free-monadic runtime.
- What you can do after
- Apply it via QuickCheck and Hspec to express properties, constrain generators, run scenarios, and inspect counterexamples.
Read how Functional Design and Architecture: Examples in Haskell explains property-based testing →
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 →
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 →
Related concepts
- QuickCheckused by · QuickCheck is a property-based testing library that generates test inputs from specifications, checks their properties, and may minimize failing counterexamples.
- forallused by · forall is a property-testing combinator that constructs a property by applying a predicate to values generated from specified generators.
- invariantuses · An invariant is a property or condition that remains true across the valid states, operations, or specified transformations of a system or computation.
- testcontrasts with · A test is a procedure or check that evaluates behavior using specified inputs or evidence against expected results or criteria.
- attributeuses · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- fuzzingcontrasts with · Fuzzing is an automated testing technique that supplies varied, malformed, unexpected, or mutated inputs to software to reveal failures, vulnerabilities, or other defects.
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.







