Codex test suite generator — unit and edge-case tests from your code
Point Codex at any function and it writes the full test suite: happy path, edge cases, error conditions, and the mocks — covering what you'd write manually but in a fraction of the time.
Paste into the Codex CLI with the code you want tested: 'Write a complete test suite for the following [LANGUAGE] code using [TEST FRAMEWORK, e.g. Jest / Pytest / Vitest / Go testing]. [PASTE YOUR CODE] Cover every case in this order: 1. HAPPY PATH TESTS: The standard scenarios where everything works as expected. For each: what input, what expected output, why this case matters. 2. EDGE CASES: - Empty inputs, null/undefined/None values - Boundary values (zero, negative numbers, empty arrays, max length strings) - Unusual but valid inputs that could trip up naive implementations 3. ERROR / EXCEPTION CASES: Every code path that throws, rejects, or returns an error state. Test that the right error is thrown with the right message, not just that any error occurs. 4. MOCKS AND STUBS: For any external dependencies (database calls, HTTP requests, file system, timers), provide the mock setup. Use [jest.fn() / unittest.mock / vi.fn()] — do not hit real external services in tests. FORMAT RULES: - One describe block per logical group of behavior - Test names as plain English sentences: describe what the test verifies, not what the function is called - No skipped (xit / @pytest.mark.skip) tests — every test must pass - No placeholder assertions (expect(true).toBe(true)) — every assertion must be meaningful - Comments only where the test setup is non-obvious The output must run with: [npm test / pytest / go test ./...] and pass without modification.' Tip: paste your existing test file alongside the source and say 'follow the existing test patterns and add coverage for these gaps:' — Codex will match your test style rather than introducing a different describe/it structure.
- Source
- promptfork seed
- License
- CC-BY-4.0
- Published
- 6/22/2026