Generate Tests
Create comprehensive tests for the specified code.
Analysis Steps
- Identify the code to test (file, function, or recent changes)
- Understand existing test patterns in the project
- Determine test framework in use (Jest, Pytest, Go test, etc.)
- Analyze code for testable behaviors
Test Categories
Unit Tests
- Test individual functions/methods in isolation
- Mock dependencies
- Cover happy path and edge cases
Edge Cases to Cover
- Empty inputs (null, undefined, [], "")
- Boundary values (0, -1, MAX_INT)
- Invalid inputs (wrong types, malformed data)
- Error conditions (network failure, timeout)
Test Structure
describe('ComponentName', () => {
describe('methodName', () => {
it('should [expected behavior] when [condition]', () => {
// Arrange
// Act
// Assert
});
});
});
Output Format
- Test file - Complete, runnable test file
- Coverage notes - What scenarios are tested
- Missing coverage - What couldn't be easily tested and why
Test Quality Checklist
Run Verification
After generating tests, offer to:
- Run the tests
- Check coverage
- Identify untested code paths