# Property-Based Testing

> The activity of checking that a stated property holds for many generated inputs, and shrinking each failure to a minimal counterexample.

Record: `architecture:property-based-testing`
Kind: activity
Layer: [Computation Core](https://banes-lab.com/records/layer/computation-core.md)
Severity: recommended
Scope: function, algorithm, parser, domain invariant
Canonical: https://banes-lab.com/ontology#architecture-property-based-testing

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Specification-Based Testing](https://banes-lab.com/records/architecture/specification-based-testing.md) and before [Static Analysis](https://banes-lab.com/records/architecture/static-analysis.md).

## Repair

- Refactored by: Define Property, Add Generator
- Detected by: missing generative tests for critical properties
- Violated by: invariant-heavy code with only example tests
- Measured by: property coverage, counterexample count
- Enforced by: property test suite

## Requires

- [Properties/Invariants](https://banes-lab.com/records/lexicon/properties-invariants.md)

## Reinforces

- [Correctness](https://banes-lab.com/records/architecture/correctness.md)
- [Robustness](https://banes-lab.com/records/lexicon/robustness.md)

## Enables

- [Broad Input Exploration](https://banes-lab.com/records/lexicon/broad-input-exploration.md)

## Conflicts with

- [Example-Only Testing](https://banes-lab.com/records/lexicon/example-only-testing.md)

## In tension with

- [Shrinking/Debug Complexity](https://banes-lab.com/records/lexicon/shrinking-debug-complexity.md)

## Tensions

- [Property-Based Testing / Shrinking/Debug Complexity](https://banes-lab.com/records/tension/property-based-testing-shrinking-debug-complexity.md)

## Severity

- [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)

## Techniques

- [Property Based Testing](https://banes-lab.com/records/reasoning/technique-property-based-testing.md)

## Category

- [Correctness / Determinism / Verification](https://banes-lab.com/records/architecture-category/correctness-determinism-verification.md)

## Linked from

- [What can drift, seen through how it drifts](https://banes-lab.com/software-architecture/coverage/what-can-drift-seen-through-how-it-drifts.md)
- [Correctness / Determinism / Verification](https://banes-lab.com/ontology/principles/architecture-category-correctness-determinism-verification.md)
- [Correctness / Determinism / Verification](https://banes-lab.com/ontology/lexicon/lexicon-category-correctness-determinism-verification.md)
- [Quality Attributes](https://banes-lab.com/ontology/lexicon/lexicon-category-quality-attributes.md)
- [The techniques](https://banes-lab.com/ontology/reasoning/the-techniques.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
