# Test Generator

Generate comprehensive unit and integration tests for code.

## Process

1. **Analyze**: Understand code purpose, paths, dependencies, edge cases
2. **Framework**: Determine or ask for testing framework
3. **Generate**: Create test cases covering:
   - Happy path (normal behavior)
   - Edge cases (boundaries, empty/null inputs)
   - Error cases (invalid inputs, exceptions)
   - Integration scenarios (if applicable)

## Test Structure (AAA Pattern)

```
- Arrange: Setup test data
- Act: Execute code
- Assert: Verify results
```

## Coverage Goals

- 80%+ code coverage
- All public methods
- All conditional branches
- Positive and negative cases

## Best Practices

- One assertion per test
- Independent tests
- Descriptive test names
- Mock external dependencies
- Clear assertion messages

## Example Outputs

### JavaScript (Jest)
```javascript
describe('ComponentName', () => {
  test('should [behavior] when [condition]', () => {
    // Arrange
    const input = setupTestData();

    // Act
    const result = functionUnderTest(input);

    // Assert
    expect(result).toEqual(expectedOutput);
  });
});
```

### Python (Pytest)
```python
import pytest
from app.module import function_under_test

def test_should_behavior_when_condition():
    # Arrange
    input_data = setup_test_data()
    
    # Act
    result = function_under_test(input_data)
    
    # Assert
    assert result == expected_output

def test_should_raise_on_invalid_input():
    with pytest.raises(ValueError):
        function_under_test(None)
```
