# Property-based vs example-based testing

> Compare named boundary examples with generated inputs. Use an independent membership rule to find cases a few well-chosen lists can miss.

Source: https://cueapril.com/compare/property-based-vs-example-based-testing
Updated: 2026-12-01
Index: https://cueapril.com/llms.txt

## Would a handful of examples find the boundary errors in this rule?

Prefer named examples for published business rules and known boundaries. Add property-based testing when many valid inputs share a rule you can check independently. Generated tests are most useful when the generator covers the relevant shapes and the assertion can distinguish correct behaviour from plausible errors.

Compare named boundary examples with generated inputs. Use an independent membership rule to find cases that a few carefully chosen lists can still miss.

Cue April editorial assessment. The sources identify documented capabilities. Suggested pilot checks are evaluation criteria.

## Build an independent membership rule

Given a list of observed IDs, a membership query should return true exactly for the IDs in that list. Test an empty list and a list with one ID as named examples. Then generate short lists and query both present and absent IDs against a simple reference set. In the [worked pandas example](/guides/agentic-software-testing#worked-example), change the observed IDs and inspect four probes from two released versions.

Property-based vs. example-based testing

| Evidence needed | Named examples | Generated properties |
| --- | --- | --- |
| Agreed boundary | Name the input and its exact result. | Include the boundary in the strategy explicitly. |
| Unexpected sparse list | Add one when its significance is known. | Generate lists with gaps and compare membership. |
| Readable failure | Show the input and asserted answer. | Save the reduced counterexample and reference answer. |
| Proof of coverage | List the cases the team selected. | Describe the input domain, settings and gaps. |

## Keep a failure after its discovery

A generator limited to consecutive positive numbers may never exercise a gap between observed IDs. Include sparse lists deliberately. If a run finds a disagreement, save the minimal case and both results as a named regression. A later random run can pass on different inputs even though the original error remains reproducible.

## Primary documentation

- [Hypothesis quickstart](https://hypothesis.readthedocs.io/en/latest/quickstart.html)

By Cue April. Updated 2026-12-01.

## Related

- [Testing comparisons](https://cueapril.com/compare): Compare testing tools and methods against a release decision. Inspect the required evidence, maintenance work and checks each approach can provide.
- [Property-based testing](https://cueapril.com/testing/property-based-testing): Run a fast-check property-based testing example: find a delivery-rule boundary fault, replay its seed and counterexample, and verify the fix.
- [Agentic testing](https://cueapril.com/guides/agentic-software-testing): Learn how agentic testing works on a pull request. Compare two AI-written tests on a real pandas bug, explore recorded results and replay the case yourself.
