Prompt
05 May 2026
Write the test class for this Apex
Not coverage — assertions. This prompt produces tests that would actually catch the bug you will write next month.
Write an Apex test class for the code below.
[PASTE APEX CLASS]
Rules:
- Build ALL data in the test; assume an empty org. Use @testSetup.
- One test method per behaviour, named test_<method>_<scenario>_<expected>
- Include: the happy path, a 200-record bulk case, the null/empty case, and the failure path with a try/catch asserting the exception
- Every test method must contain at least one Assert with a failure message
- Do NOT use SeeAllData, hardcoded Ids, or Test.isRunningTest branches
After the code, list the behaviours you could NOT test and why.Not coverage — assertions. This prompt produces tests that would actually catch the bug you will write next month.
Why it works
The rules encode the review checklist most teams enforce by hand, so the output arrives pre-reviewed. The closing instruction — list what you could not test — surfaces the seams (callouts, async) that need mocks before you discover it in the deploy.