# Specification-Based Testing

> The activity of deriving tests from a specification's stated behavior, independently of how the code implements it.

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

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Formal Verification](https://banes-lab.com/records/architecture/formal-verification.md) and before [Property-Based Testing](https://banes-lab.com/records/architecture/property-based-testing.md).

## Repair

- Refactored by: Add Spec Tests
- Detected by: lack of spec-derived tests
- Violated by: tests coupled to implementation details
- Measured by: spec coverage
- Enforced by: test gates

## Requires

- [Specification](https://banes-lab.com/records/lexicon/specification.md)

## Reinforces

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

## Enables

- [Behavior Validation](https://banes-lab.com/records/lexicon/behavior-validation.md)

## Conflicts with

- [Implementation-Only Testing](https://banes-lab.com/records/lexicon/implementation-only-testing.md)
- [Mock Mirage](https://banes-lab.com/records/architecture/mock-mirage.md)

## In tension with

- [Spec Maintenance](https://banes-lab.com/records/lexicon/spec-maintenance.md)

## Tensions

- [Specification-Based Testing / Spec Maintenance](https://banes-lab.com/records/tension/spec-maintenance-specification-based-testing.md)

## Contracts

- [Test Coverage Kernel](https://banes-lab.com/records/algorithms/test-coverage-kernel.md)

## Severity

- [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.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)
- [Anti-patterns](https://banes-lab.com/ontology/principles/architecture-category-anti-patterns.md)
- [Correctness / Determinism / Verification](https://banes-lab.com/ontology/principles/architecture-category-correctness-determinism-verification.md)
- [Core Vocabulary](https://banes-lab.com/ontology/lexicon/lexicon-category-core-vocabulary.md)
- [Correctness / Determinism / Verification](https://banes-lab.com/ontology/lexicon/lexicon-category-correctness-determinism-verification.md)
- [Test coverage](https://banes-lab.com/ontology/algorithms/algorithms-domain-test-coverage.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
