Knowledge and patterns for designing comprehensive test strategies and writing effective tests.
View on GitHubdrewdresser/ai-dev-settings
ai-dev
skills/designing-tests/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/drewdresser/ai-dev-settings/blob/main/skills/designing-tests/SKILL.md -a claude-code --skill designing-testsInstallation paths:
.claude/skills/designing-tests/# Designing Tests Skill
This skill provides patterns and techniques for creating effective test suites.
## Testing Pyramid
```
/\
/ \ E2E (10%)
/----\
/ \ Integration (20%)
/--------\
/ \ Unit (70%)
/------------\
```
## Test Design Patterns
### 1. Arrange-Act-Assert (AAA)
```python
def test_user_registration():
# Arrange - Set up test data and dependencies
user_data = {"email": "test@example.com", "password": "secure123"}
# Act - Execute the code under test
result = register_user(user_data)
# Assert - Verify the outcome
assert result.success is True
assert result.user.email == "test@example.com"
```
### 2. Given-When-Then (BDD)
```python
def test_discount_for_premium_users():
# Given a premium user with items in cart
user = create_premium_user()
cart = create_cart(user, items=[item(price=100)])
# When calculating the total
total = cart.calculate_total()
# Then a 20% discount is applied
assert total == 80
```
### 3. Test Fixtures
```python
@pytest.fixture
def db_session():
"""Provide a clean database session for each test."""
session = create_session()
yield session
session.rollback()
session.close()
@pytest.fixture
def authenticated_user(db_session):
"""Provide an authenticated user."""
user = User.create(email="test@example.com")
db_session.add(user)
db_session.commit()
return user
```
### 4. Parameterized Tests
```python
@pytest.mark.parametrize("input,expected", [
("hello", "HELLO"),
("World", "WORLD"),
("", ""),
("123abc", "123ABC"),
])
def test_uppercase(input, expected):
assert uppercase(input) == expected
```
## Edge Cases Checklist
### Input Validation
- [ ] Empty/null inputs
- [ ] Boundary values (0, -1, MAX_INT)
- [ ] Invalid types
- [ ] Special characters
- [ ] Unicode strings
- [ ] Very long inputs
- [ ] Whitespace handling
### State Management