Test Design | Skills Pool
Test Design Designs comprehensive test suites by identifying test cases, creating test plans, writing unit and integration tests, and ensuring edge case coverage. Use when writing new tests, improving test coverage, designing test strategies, or when asked to create test cases for features or bug fixes.
Chisanan232 0 스타 2026. 3. 29. Test Design Skill
Purpose
This skill provides a systematic approach to designing comprehensive, maintainable tests that verify behavior and prevent regressions.
When to Invoke This Skill
Use this skill when:
Designing tests for a new feature
Adding tests to untested code
Improving test coverage
Refactoring tests for better clarity
When NOT to Invoke This Skill
Do not use this skill for:
Running existing tests (just run them)
Debugging failing tests (use ci-failure-triage)
Simple test updates (make the change directly)
Prerequisites
Before designing tests:
Consult AGENTS.md for testing conventions
npx skillvault add Chisanan232/chisanan232-ai-development-config-windsurf-skills-test-design-skill-md
스타 0
업데이트 2026. 3. 29.
직업
Understand the behavior being tested
Identify test types needed (unit, integration, E2E)
Check existing test patterns in the codebase
Test Design Process
Phase 1: Understand What to Test
Identify the behavior
What should this code do?
What are the inputs and outputs?
What are the side effects?
What are the dependencies?
Identify test boundaries
What is in scope for this test?
What should be mocked or stubbed?
What is the appropriate test level (unit, integration, E2E)?
Consult AGENTS.md
Where should tests be located?
What test framework is used?
What naming conventions apply?
What coverage threshold is required?
Phase 2: Identify Test Scenarios Use this framework to identify scenarios:
1. Happy Path (Normal Cases)
Valid inputs : Normal, expected usage
Typical workflows : Common user journeys
Expected outputs : Correct results for valid inputs
2. Edge Cases (Boundary Conditions)
Empty inputs : Empty strings, empty arrays, zero values
Null/undefined : Missing or null values
Boundary values : Min/max values, first/last elements
Large inputs : Large datasets, long strings
Special characters : Unicode, special symbols, escape sequences
3. Error Cases (Failure Conditions)
Invalid inputs : Wrong types, out-of-range values
Missing required data : Null when non-null expected
Constraint violations : Duplicate keys, invalid formats
External failures : Network errors, database errors, file system errors
4. Integration Points
Component interactions : How components work together
External dependencies : APIs, databases, file systems
State changes : How state is modified and persisted
Concurrent access : Race conditions, locking (if applicable)
Phase 3: Choose Test Types
Unit Tests
Testing individual functions, methods, or classes
Testing business logic in isolation
Testing pure functions and calculations
Fast (milliseconds)
Isolated (mock external dependencies)
Focused (one unit of behavior)
Function returns correct value for given input
Method throws error for invalid input
Class maintains correct internal state
Integration Tests
Testing component interactions
Testing database queries
Testing API endpoints
Testing service integrations
Slower than unit tests (seconds)
Use real dependencies where practical
Test multiple components together
API endpoint returns correct data from database
Service correctly calls external API
Components communicate correctly
End-to-End Tests
Testing critical user flows
Testing full system behavior
Testing UI interactions
Slowest (seconds to minutes)
Test the entire system
Use real environment
User can complete signup flow
User can checkout and purchase
Admin can manage users
Phase 4: Write Test Structure
Test Naming Follow project conventions (consult AGENTS.md), but generally:
Descriptive names : test_user_login_with_valid_credentials
Behavior-focused : should_return_error_when_email_is_invalid
Scenario-based : given_empty_cart_when_checkout_then_error
Test Organization Use the AAA pattern (Arrange-Act-Assert):
// Arrange: Set up test data and conditions
const user = createTestUser();
const credentials = { email: user.email, password: 'password123' };
// Act: Execute the behavior being tested
const result = await authService.login(credentials);
// Assert: Verify the outcome
expect(result.token).toBeDefined();
expect(result.user.id).toBe(user.id);
Or Given-When-Then for BDD:
// Given: Initial context
Given a registered user with email "[email protected] "
// When: Action or event
When the user logs in with correct credentials
// Then: Expected outcome
Then a valid JWT token is returned
And the user session is created
Phase 5: Implement Tests
Write the test
Follow the test structure (AAA or Given-When-Then)
Use clear, descriptive assertions
Keep tests simple and focused
Use appropriate assertions
Be specific: expect(value).toBe(42) not expect(value).toBeTruthy()
Test behavior: expect(fn).toThrow(Error) not implementation details
Use meaningful messages: expect(result, 'User should be authenticated').toBeDefined()
Mock external dependencies
Mock network calls
Mock database queries (for unit tests)
Mock file system operations
Use test doubles (mocks, stubs, spies) appropriately
Set up and tear down
Use setup/teardown hooks (beforeEach, afterEach)
Clean up resources (close connections, delete test data)
Ensure tests are independent
Phase 6: Validate Tests
Run the tests
Verify tests pass
Verify tests fail when they should (test the test)
Check test output is clear
Check test quality
Are tests deterministic (same result every time)?
Are tests independent (no shared state)?
Are tests fast enough?
Are tests readable and maintainable?
Verify coverage
Run coverage tool (consult AGENTS.md)
Check that critical paths are covered
Identify gaps in coverage
Do Not Assume
Do not assume test framework without checking AGENTS.md
Do not assume test location or naming conventions
Do not assume mocking library or patterns
Do not assume coverage requirements
Do not assume test commands
Always consult AGENTS.md first.
Test Design Patterns
Pattern 1: Test Data Builders Create reusable test data builders:
def create_test_user(**overrides):
defaults = {
'email': '[email protected] ',
'name': 'Test User',
'role': 'user'
}
return User(**{**defaults, **overrides})
Pattern 2: Parameterized Tests Test multiple scenarios with one test:
@pytest.mark.parametrize("input,expected", [
("hello", "HELLO"),
("world", "WORLD"),
("", ""),
])
def test_uppercase(input, expected):
assert uppercase(input) == expected
Pattern 3: Test Fixtures @pytest.fixture
def authenticated_client():
client = TestClient()
client.login(username='test', password='test')
return client
Common Test Anti-Patterns to Avoid
Testing implementation details : Test behavior, not internal structure
Overly complex tests : If a test is hard to understand, simplify it
Brittle tests : Tests should not break when unrelated code changes
Slow tests : Optimize slow tests or move them to integration/E2E
Flaky tests : Tests must be deterministic
Testing the framework : Do not test library or framework behavior
Shared state between tests : Each test should be independent
Validation Checklist Before considering tests complete:
Integration with Other Skills
Before test design : Use feature-implementation to understand the feature
After test design : Run tests and verify they pass
If tests fail : Use ci-failure-triage to diagnose
If coverage is low : Use coverage-regression-repair
Example Workflow 1. User requests: "Add tests for user authentication"
2. Consult AGENTS.md:
- Test location: tests/unit/auth/
- Test framework: pytest
- Naming: test_*.py
3. Identify scenarios:
Happy path:
- Valid credentials → successful login
- Valid token → authenticated request
Edge cases:
- Empty email → validation error
- Empty password → validation error
Error cases:
- Invalid credentials → authentication error
- Expired token → token expired error
- Missing token → unauthorized error
4. Choose test types:
- Unit tests for auth service logic
- Integration tests for auth endpoints
5. Write tests:
- test_login_with_valid_credentials()
- test_login_with_invalid_credentials()
- test_login_with_empty_email()
- test_authenticated_request_with_valid_token()
- test_authenticated_request_with_expired_token()
6. Run and validate:
- All tests pass
- Coverage meets threshold
Notes
This is a generic skill. Always adapt to project-specific requirements.
Consult AGENTS.md before making assumptions.
Good tests are an investment in code quality and maintainability.
When in doubt, ask the user for clarification.
02
Purpose