---
title: "Treat coverage as a floor · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/test-quality/coverage-floor
updated: 2026-10-20
licence: "All rights reserved"
---

# Treat coverage as a floor

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Test quality](https://agentwranglers.se/playbook/testing/test-quality)
- Rule: Use line and branch coverage to find untested code and to stop it falling. Never treat a high number as proof of good tests.
- How: Set a minimum at today's coverage, rounded down to a whole number, in the runner, such as Vitest `coverage.thresholds`, Jest `coverageThreshold` or pytest-cov `--cov-fail-under`. Raise it as coverage grows. Read the report for risky code with no tests, rather than chasing a total.
- Check: The test run fails when coverage falls below the set minimum.

Example:

```js
// vitest.config.js
export default {
  test: {
    coverage: { provider: 'v8', thresholds: { lines: 80, branches: 75 } },
  },
};
```

```toml
# pyproject.toml for pytest-cov and coverage.py
[tool.coverage.run]
branch = true

[tool.coverage.report]
fail_under = 80
```

```kotlin
// build.gradle.kts with JaCoCo for Java and Kotlin
tasks.jacocoTestCoverageVerification {
    violationRules { rule { limit { minimum = "0.80".toBigDecimal() } } }
}
tasks.check { dependsOn(tasks.jacocoTestCoverageVerification) }
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-quality/coverage-floor`.

- Previous: [Prove the tests catch bugs](https://agentwranglers.se/playbook/testing/test-quality/mutation-testing)
- Next: [Make every test able to fail](https://agentwranglers.se/playbook/testing/test-quality/tests-can-fail)
- [Test quality](https://agentwranglers.se/playbook/testing/test-quality)
