-
Testing
Turn my fixed bugs into regression tests
Write a test that reproduces each bug you've already fixed, so none of them ever come back.
Free Prompt
I've fixed a bunch of bugs in my app already, and I don't want any of them coming back. I want regression tests for the bugs I've already squashed.
I'll describe bugs I've fixed (or point you at commit messages, a changelog, or issue tracker entries). For each one:
1. Understand what the bug was: what input or sequence triggered it, and what the wrong behavior was.
2. Write a test that would have FAILED against the buggy code and passes against the fixed code. If you can't tell from the code what the buggy version looked like, ask me.
3. Put the test in the right place in my suite with a name that references the bug, so future me knows why it exists.
Where the bug was user-facing (a broken flow, a wrong calculation), prefer a test at that level. Where it was internal, a focused unit test is fine.
Don't write tests that pass against both the buggy and fixed versions. A regression test that can't catch the regression is decoration.
When finished, run the new tests and give me a table: bug, what triggered it, and the test that now guards it.
What This Does / How This Helps
This converts your fixed bugs into regression tests: each test reproduces the original failure and guards against it returning. Bugs you've already hit are your best test inventory, because they're proven to be things your app actually gets wrong, not theoretical risks. Without a regression test, a refactor six months from now can quietly reintroduce the exact bug a user already reported once. Users forgive a bug. They don't forgive the same bug twice.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).