In plain words
A test is a small piece of code that runs your feature and checks the result, so the agent can prove a fix instead of claiming it.
Where you see it
Claude Code or Cursor running npm test and printing a line like "1 failed, 12 passed" in the terminal. The best moment to ask for one is right after a bug: a test that fails now and passes after the fix stops that bug from quietly coming back.
What goes wrong
- The agent edits the test to match the bug
When a test fails, an agent may change what the test expects instead of fixing the code. A changed number in a test file is worth a second look.
expect(total).toBe(20) // was 18 - Tests that can't fail
A test that only checks the page loads passes no matter what the feature does. Ask which bug each test would catch.
- Asking for full coverage on day one
"Add tests for everything" gets you hundreds of shallow tests that break on every change. Start with the paths that cost money or data: login, checkout, saving.
What to tell your agent
Quick check
Sign in to earn +10 XP for itA test fails after a fix, and the agent changes the expected total in the test from 18 to 20. What happened?