AI Help

How do I get an AI coding agent to add a regression test for an existing bug?

Ask for a test that demonstrates the bug through the normal interface and passes after the fix. Review its assertions against the intended behavior.

Steps to follow

  1. Describe the observable failure and the expected result using a small real-world example.
  2. Require the test to fail on the original code for the relevant reason, then implement the fix.
  3. Run the new test and related existing checks. Avoid assertions that merely repeat the implementation's internal steps.

Example in practice

Illustrative example. A retry bug test submits the same event twice and checks that only one destination record exists.

Related AI help

Official guidance

OpenAI documentation