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. lessloc catches it as copied-tests.
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.
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:
- Reimplementing a helper the project already has: lessloc gives every session the rule: take what is already in the codebase before new code.
- Copying a rule another function owns: lessloc catches it as
repeated-literal. - Keeping old and new versions side by side: lessloc gives every session the rule: one implementation per rule.
- Rebuilding what the standard library or framework has: lessloc gives every session a rule against it and catches it as
simplerandreinvented. - A second library for a job an installed one already does:
new-dependencynames the library that is already installed. - The same data shape in several layers (DTO, model, entity):
copycatches identical type bodies. - The same CSS declarations under another selector: lessloc catches it as
style-copy.

