pal-testgen
Comprehensive test suite generation with edge case coverage using PAL MCP. Use for creating tests, improving coverage, or identifying untested paths. Triggers on test generation requests, coverage improvement, or testing strategy.
When & Why to Use This Skill
This Claude skill automates the creation of comprehensive test suites using PAL MCP to ensure high-quality software delivery. It specializes in generating robust unit and integration tests, identifying hidden edge cases, and improving overall code coverage. By analyzing complex business logic and execution paths, it helps developers eliminate bugs early and maintain stable codebases through automated regression testing.
Use Cases
- Automated Test Generation: Rapidly creating unit and integration tests for new features to ensure immediate code reliability.
- Edge Case Discovery: Identifying and covering boundary conditions, null values, and complex failure modes that are often overlooked during manual testing.
- Coverage Improvement: Analyzing existing codebases to find untested execution paths and generating the necessary tests to fill coverage gaps.
- API Endpoint Testing: Generating comprehensive test scenarios for APIs, including happy paths, input validation, rate limiting, and error handling.
- Regression Testing: Creating a suite of tests for legacy code to ensure that new changes do not break existing functionality.
| name | pal-testgen |
|---|---|
| description | Comprehensive test suite generation with edge case coverage using PAL MCP. Use for creating tests, improving coverage, or identifying untested paths. Triggers on test generation requests, coverage improvement, or testing strategy. |
PAL Test Generation
Create comprehensive test suites with edge case coverage.
When to Use
- Generating tests for new code
- Improving test coverage
- Identifying edge cases
- Creating regression tests
- Testing complex business logic
- Framework-specific test generation
Quick Start
result = mcp__pal__testgen(
step="Analyzing payment processor for test coverage",
step_number=1,
total_steps=2,
next_step_required=True,
findings="Identifying critical paths, edge cases, failure modes",
relevant_files=[
"/app/payments/processor.py",
"/app/payments/validation.py"
],
confidence="exploring"
)
Required Parameters
| Parameter | Type | Description |
|---|---|---|
step |
string | Test planning narrative |
step_number |
int | Current step |
total_steps |
int | Estimated total |
next_step_required |
bool | More planning needed? |
findings |
string | Test scenarios identified |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
hypothesis |
string | Testing strategy |
confidence |
enum | exploring → certain |
relevant_files |
list | Files needing tests |
files_checked |
list | All files examined |
issues_found |
list | Coverage gaps found |
continuation_id |
string | Continue session |
What to Document in Findings
Functionality Coverage
- Core business logic paths
- Input validation
- Error handling
- Edge cases
Test Categories
- Unit tests - Individual functions/methods
- Integration tests - Component interactions
- Edge cases - Boundary conditions
- Error cases - Failure scenarios
Example: API Endpoint Tests
mcp__pal__testgen(
step="""
Analyzing user registration endpoint for test coverage
Identified paths:
1. Happy path - valid registration
2. Validation - email format, password strength
3. Duplicates - existing email handling
4. Rate limiting - abuse prevention
5. Error cases - database failures
""",
step_number=1,
total_steps=2,
next_step_required=True,
findings="""
Critical test cases:
- Valid registration creates user and returns token
- Invalid email format returns 400
- Weak password returns 400 with requirements
- Duplicate email returns 409
- Rate limit exceeded returns 429
- Database error returns 500 and logs error
Edge cases:
- Unicode characters in name
- Maximum length inputs
- Empty string vs null vs missing field
- SQL injection attempts (should be sanitized)
""",
relevant_files=[
"/app/api/auth/register.py",
"/app/models/user.py",
"/tests/api/test_auth.py"
],
confidence="medium"
)
Test Template Patterns
Unit Test
def test_calculate_total_with_discount():
# Arrange
cart = Cart(items=[Item(price=100)])
discount = Discount(percent=10)
# Act
total = cart.calculate_total(discount)
# Assert
assert total == 90
Edge Case Test
@pytest.mark.parametrize("input,expected", [
("", ValidationError),
(None, ValidationError),
("a" * 1000, ValidationError),
("valid@email.com", "valid@email.com"),
])
def test_email_validation(input, expected):
if isinstance(expected, type) and issubclass(expected, Exception):
with pytest.raises(expected):
validate_email(input)
else:
assert validate_email(input) == expected
Best Practices
- Test behavior, not implementation - Focus on what, not how
- One assertion per test - Clear failure messages
- Descriptive names -
test_user_cannot_access_admin_without_role - Arrange-Act-Assert - Clear test structure
- Cover edge cases - Boundaries, nulls, empty values
- Test error paths - Failures are features too