Guide
What you get: The agent writes integration tests against the real database covering success, 401/403, each validation rule, 404, 409 and duplicate submission, with factories and per-test cleanup. Best for Backend developers adding tests to an existing endpoint..
Before you start
- The endpoint code (paste it into endpoint_code) and a repo where the app can be started in tests
- A real test database the tests can create and clean (we used SQLite in memory)
- Fill test_framework (we used Vitest + Supertest)
Worked example (Nov 14, 2026, Claude Code 2.1.318 (claude-opus-5-5); Codex 0.151.0 (gpt-5.6-sol))
Input
POST /api/workshops/:id/bookings (Express 5 + node:sqlite): bearer-token auth, member-only (403 for guests), zod validation of seats (1-4) and contactPhone, 404 for missing workshops, 409 for full workshops and repeat bookings, Idempotency-Key replay.
Result
Claude Code: 42 tests in tests/bookings.test.ts plus tests/factories.ts, each test on its own openDb(':memory:'); two `it.fails` tests document a bug it found (idempotency keys aren't scoped per user or workshop). Codex: 12 tests with in-file factories and a fresh in-memory DB per test.Both suites pass when we run them (40 + 2 expected-fail; 12), tsc clean, no vi.mock. Codex couldn't run its tests in its sandbox (Supertest 'listen EPERM') and said so. Mutation check, 8 deliberate bugs in the endpoint: Claude Code's tests caught 8/8, Codex's 7/8 (it doesn't test the seats upper bound). Only Claude Code found the real idempotency bug.
How to check it worked
- Run the suite, then break the endpoint on purpose (remove the 403 check, raise the seats limit) and confirm a test fails
- grep for vi.mock / jest.mock: the database shouldn't be mocked
- Check each test cleans up its data
Common problems
- Only the lower bound of a range gets tested
- Tests that can't run in the agent's sandbox (socket binding) go unverified there
Log in to join the discussion.