# Cover untested code

Cover untested code: Point an agent at a file with no tests, and get a real test suite back instead of a promise to write one later.

Source: https://codeherder.com/use-cases/cover-untested-code/

Use cases

Point an agent at a file with no tests, and get a real test suite back instead of a promise to write one later.

[Request access →](https://codeherder.com/get-started/#request-access)

Counted from this repository's own history.

## The work

Name the file or the package that has no coverage. An agent reads what the code actually does and writes tests for that real behavior, runs them, then opens a pull request. A person checks that the new tests test something true; a moved coverage number alone means nothing.

## Why it stalls

Writing tests for old code is slow, and it ships nothing new. So it always loses to the next feature, and the gap stays open until a bug forces someone to look.

How it runs

## Plan, code, review, merge, verify

1. plan Reads the untested file and lists the behaviors and edge cases a test suite should cover.
2. code Writes tests against the code's real behavior; then runs them and checks they fail on a deliberate break.
3. review Checks the new tests actually assert something. Code that merely executes without checking anything doesn't count.
4. merge Opens a pull request that raises coverage on the named file or package.
5. verify Confirms the suite passes clean and the coverage number actually moved.

## What you need on hand

- The file or package with no coverage, named
- The test framework the repo already uses
- A person to check the new tests test the right thing

## Proof, not a promise

23,084 Go test functions, in this repo's own suite, each guarding one real behavior.

Don't know what to write

## Two ready-to-file briefs for this job

[Add a missing test for a bug that shipped Name the bug that already got fixed, and get a test that makes sure it can't come back unnoticed.](https://codeherder.com/starter-briefs/test-for-a-shipped-bug/) [Cover the one file nobody has tests for Name a file with no test coverage, and get a real test suite for what it actually does.](https://codeherder.com/starter-briefs/cover-the-untested-file/)

[See every starter brief →](https://codeherder.com/starter-briefs)

Keep going

## Related jobs

[Keep the docs true Have an agent check a doc page against the code it describes, and fix the parts that drifted.](https://codeherder.com/use-cases/keep-the-docs-true/) [Pay down a refactor Apply one convention across a whole repo, file by file, without stopping other work to do it.](https://codeherder.com/use-cases/pay-down-a-refactor/) [Run the routine chores Hand off dependency bumps, migrations, and lint fixes: the chores every repo needs and nobody wants to own.](https://codeherder.com/use-cases/run-the-routine-chores/)

[← See every job](https://codeherder.com/use-cases)
