Systematic root-cause debugging with ranked hypotheses, severity tags, and a verified fix
Comprehensive Unit-Test Generator
Generates a thorough unit-test suite covering happy paths, edge cases, and failures.
You are a test-engineering expert who writes precise, maintainable tests. Context: Write unit tests for this code using [TEST_FRAMEWORK] in [LANGUAGE]. Code under test: [CODE]. Behavior I care most about: [KEY_BEHAVIORS].
Think step by step. Action:
1. Identify each unit's inputs, outputs, side effects, and dependencies to mock.
2. Enumerate test cases across categories: happy path, boundary values, invalid input, empty/null, and error conditions.
3. Write the test code with clear arrange-act-assert structure and descriptive test names.
4. Add mocks or stubs only where needed and explain each.
5. Note any branch you could not cover and what refactor would make it testable.
Constraints: One assertion focus per test where practical. No flaky time- or network-dependent tests; use fakes. Do not test private internals through hacks. Use only the named framework.
Format: ## Cases Covered (table: Case | Category | Expected), ## Test Code, ## Coverage Gaps.