The test should fail for the reported reason before any production code changes.
The decision behind the technique
A bug description can be incomplete or point at the wrong cause. A minimal failing test distinguishes the observed behavior from the reporter’s theory.
The test should fail for the reported reason before any production code changes.
A practical step-by-step workflow
Use this sequence as a default, then tighten or expand it only when the evidence changes.
- Translate the report into one observable expectation
- Create the smallest fixture that triggers it
- Run the test and confirm the expected failure
- Implement the fix and prove the same test passes
Failure boundary and finish line
A test that passes before the fix is not evidence that the bug has been reproduced.
Finish when another person can reproduce the check against the exact final state.
Frequently asked questions
What should I do first?+
Translate the report into one observable expectation
What is the main failure mode?+
A test that passes before the fix is not evidence that the bug has been reproduced.
OFFICIAL SOURCES
Verify against the source
OpenAI Codex best practicespytest usage guideThis guide provides general information, not an OpenAI allowance promise or support decision. Your account and official pages govern actual usage, benefits and recovery times.