generate tests from existing code
You need tests written from existing code—coverage without inventing an architecture religion.
recs
| model | best when | avoid when | cost vibe |
|---|---|---|---|
| Sonnet-class | The code has tricky edge cases, asynchronous behavior, or a history of flaky failures. | You need to generate 200 trivial tests and volume matters more than judgment. | $$$ |
| Faster / cheaper cloud model | You need boilerplate unit tests and straightforward happy-path coverage. | The behavior depends on subtle concurrency, timing, or hard-to-reproduce flakes. | $ |
| Local mid | The repository must stay private or you are experimenting with test generation in offline CI. | You need realistic failure cases rather than plausible-looking assertions around the happy path. | ~free |
why
- Test generation rewards concrete examples and sound judgment more than raw speed.
- Cheap models tend to overfit to the happy path and miss the bug that actually matters.
- Frontier models earn their cost when the failure mode is ambiguous and the useful assertion is not obvious.
- Local models are fine for private code if you review their tests and failure cases aggressively.