# Test Pyramid Inversion

> A defect in which a test suite relies mainly on slow end-to-end tests, with few unit and contract tests.

Record: `architecture:test-pyramid-inversion`
Kind: anti-pattern
Layer: [Enforcement Core](https://banes-lab.com/records/layer/enforcement-core.md)
Severity: discouraged
Scope: contract_compatibility
Canonical: https://banes-lab.com/ontology#architecture-test-pyramid-inversion

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Feature-Only Design](https://banes-lab.com/records/architecture/feature-only-design.md) and before [Mock Mirage](https://banes-lab.com/records/architecture/mock-mirage.md).

## Repair

- Refactored by: add_unit_tests, contract_tests, component_tests, property_tests, reduce_E2E_scope
- Detected by: high_E2E_ratio, slow_CI, flaky_integration_tests, low_unit_contract_coverage
- Violated by: Rely mainly on slow, brittle end-to-end tests while unit, contract, component, and property tests are sparse.
- Measured by: share of end-to-end tests, suite duration
- Enforced by: test-suite composition review, limits on CI duration

## Severity

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

## Category

- [Anti-patterns](https://banes-lab.com/records/architecture-category/anti-patterns.md)

## Force

- [Contract compatibility](https://banes-lab.com/records/force/contract-compatibility.md)

## Negated by

- [Testability](https://banes-lab.com/records/architecture/testability.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)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The forces](https://banes-lab.com/ontology/schema/the-forces.md)
