# Copy-pasted test cases instead of one parametrized test

*Code that already exists*: one of the ways AI coding agents bloat software, from lessloc's [pattern catalog](https://lessloc.org/patterns/index.md). lessloc catches it as [`copied-tests`](https://lessloc.org/guide/reference.md#tier-2).

## What makes copy-pasted test cases instead of one parametrized test a bad practice?

The standard that calls it a bad practice: Meszaros, *xUnit Test Patterns*: Test Code Duplication.

## What does lessloc do about copy-pasted test cases instead of one parametrized test?

lessloc catches it as [`copied-tests`](https://lessloc.org/guide/reference.md#tier-2).

- `copied-tests` (tier 2): Copy-pasted test cases that one table-driven test would cover.

## Related patterns

The other patterns in [Code that already exists](https://lessloc.org/patterns/index.md#code-that-already-exists):

- [Reimplementing a helper the project already has](https://lessloc.org/patterns/reuse-helper.md): lessloc gives every session the rule: take what is already in the codebase before new code.
- [Copying a rule another function owns](https://lessloc.org/patterns/copied-rule.md): lessloc catches it as `repeated-literal`.
- [Keeping old and new versions side by side](https://lessloc.org/patterns/side-by-side.md): lessloc gives every session the rule: one implementation per rule.
- [Rebuilding what the standard library or framework has](https://lessloc.org/patterns/rebuilt-library.md): lessloc gives every session a rule against it and catches it as `simpler` and `reinvented`.
- [A second library for a job an installed one already does](https://lessloc.org/patterns/second-library.md): `new-dependency` names the library that is already installed.
- [The same data shape in several layers (DTO, model, entity)](https://lessloc.org/patterns/duplicate-shapes.md): `copy` catches identical type bodies.
- [The same CSS declarations under another selector](https://lessloc.org/patterns/css-copy.md): lessloc catches it as `style-copy`.
