test-design-techniques
关于
This Claude Skill provides systematic test design techniques including boundary value analysis, equivalence partitioning, and decision tables. It helps developers create comprehensive test cases while reducing redundancy through methods like pairwise testing. Use it when designing tests for complex business rules, stateful behavior, or ensuring systematic coverage.
快速安装
Claude Code
推荐/plugin add https://github.com/proffesor-for-testing/agentic-qegit clone https://github.com/proffesor-for-testing/agentic-qe.git ~/.claude/skills/test-design-techniques在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Test Design Techniques
<default_to_action> When designing test cases systematically:
- APPLY Boundary Value Analysis (test at min, max, edges)
- USE Equivalence Partitioning (one test per partition)
- CREATE Decision Tables (for complex business rules)
- MODEL State Transitions (for stateful behavior)
- REDUCE with Pairwise Testing (for combinations)
Quick Design Selection:
- Numeric ranges → BVA + EP
- Multiple conditions → Decision Tables
- Workflows → State Transition
- Many parameters → Pairwise Testing
Critical Success Factors:
- Systematic design finds more bugs with fewer tests
- Random testing is inefficient
- 40+ years of research backs these techniques </default_to_action>
Quick Reference Card
When to Use
- Designing new test suites
- Optimizing existing tests
- Complex business rules
- Reducing test redundancy
Technique Selection Guide
| Scenario | Technique |
|---|---|
| Numeric input ranges | BVA + EP |
| Multiple conditions | Decision Tables |
| Stateful workflows | State Transition |
| Many parameter combinations | Pairwise |
| All combinations critical | Full Factorial |
Boundary Value Analysis (BVA)
Principle: Bugs cluster at boundaries.
Test at boundaries:
- Minimum valid value
- Just below minimum (invalid)
- Just above minimum (valid)
- Maximum valid value
- Just above maximum (invalid)
// Age field: 18-120 valid
const boundaryTests = [
{ input: 17, expected: 'invalid' }, // Below min
{ input: 18, expected: 'valid' }, // Min boundary
{ input: 19, expected: 'valid' }, // Above min
{ input: 119, expected: 'valid' }, // Below max
{ input: 120, expected: 'valid' }, // Max boundary
{ input: 121, expected: 'invalid' } // Above max
];
Equivalence Partitioning (EP)
Principle: One test per equivalent class.
// Discount rules:
// 1-10: No discount
// 11-100: 10% discount
// 101+: 20% discount
const partitionTests = [
{ quantity: -1, expected: 'invalid' }, // Invalid partition
{ quantity: 5, expected: 0 }, // Partition 1: 1-10
{ quantity: 50, expected: 0.10 }, // Partition 2: 11-100
{ quantity: 200, expected: 0.20 } // Partition 3: 101+
];
// 4 tests cover all behavior (vs 200+ if testing every value)
Decision Tables
Use for: Complex business rules with multiple conditions.
Loan Approval Rules:
┌──────────────┬───────┬───────┬───────┬───────┬───────┐
│ Conditions │ R1 │ R2 │ R3 │ R4 │ R5 │
├──────────────┼───────┼───────┼───────┼───────┼───────┤
│ Age ≥ 18 │ Yes │ Yes │ Yes │ No │ Yes │
│ Credit ≥ 700 │ Yes │ Yes │ No │ Yes │ No │
│ Income ≥ 50k │ Yes │ No │ Yes │ Yes │ Yes │
├──────────────┼───────┼───────┼───────┼───────┼───────┤
│ Result │Approve│Approve│Reject │Reject │Reject │
└──────────────┴───────┴───────┴───────┴───────┴───────┘
// 5 tests cover all decision combinations
State Transition Testing
Model state changes:
States: Logged Out → Logged In → Premium → Suspended
Valid Transitions:
- Login: Logged Out → Logged In
- Upgrade: Logged In → Premium
- Payment Fail: Premium → Suspended
- Logout: Any → Logged Out
Invalid Transitions to Test:
- Logged Out → Premium (should reject)
- Suspended → Premium (should reject)
test('cannot upgrade without login', async () => {
const result = await user.upgrade(); // While logged out
expect(result.error).toBe('Login required');
});
Pairwise (Combinatorial) Testing
Problem: All combinations explode exponentially.
// Parameters:
// Browser: Chrome, Firefox, Safari (3)
// OS: Windows, Mac, Linux (3)
// Screen: Desktop, Tablet, Mobile (3)
// All combinations: 3 × 3 × 3 = 27 tests
// Pairwise: 9 tests cover all pairs
const pairwiseTests = [
{ browser: 'Chrome', os: 'Windows', screen: 'Desktop' },
{ browser: 'Chrome', os: 'Mac', screen: 'Tablet' },
{ browser: 'Chrome', os: 'Linux', screen: 'Mobile' },
{ browser: 'Firefox', os: 'Windows', screen: 'Tablet' },
{ browser: 'Firefox', os: 'Mac', screen: 'Mobile' },
{ browser: 'Firefox', os: 'Linux', screen: 'Desktop' },
{ browser: 'Safari', os: 'Windows', screen: 'Mobile' },
{ browser: 'Safari', os: 'Mac', screen: 'Desktop' },
{ browser: 'Safari', os: 'Linux', screen: 'Tablet' }
];
// Each pair appears at least once
Agent-Driven Test Design
// Auto-generate BVA tests
await Task("Generate BVA Tests", {
field: 'age',
dataType: 'integer',
constraints: { min: 18, max: 120 }
}, "qe-test-generator");
// Returns: 6 boundary test cases
// Auto-generate pairwise tests
await Task("Generate Pairwise Tests", {
parameters: {
browser: ['Chrome', 'Firefox', 'Safari'],
os: ['Windows', 'Mac', 'Linux'],
screen: ['Desktop', 'Tablet', 'Mobile']
}
}, "qe-test-generator");
// Returns: 9-12 tests (vs 27 full combination)
Agent Coordination Hints
Memory Namespace
aqe/test-design/
├── bva-analysis/* - Boundary value tests
├── partitions/* - Equivalence partitions
├── decision-tables/* - Decision table tests
└── pairwise/* - Combinatorial reduction
Fleet Coordination
const designFleet = await FleetManager.coordinate({
strategy: 'systematic-test-design',
agents: [
'qe-test-generator', // Apply design techniques
'qe-coverage-analyzer', // Analyze coverage
'qe-quality-analyzer' // Assess test quality
],
topology: 'sequential'
});
Related Skills
- agentic-quality-engineering - Agent-driven testing
- risk-based-testing - Prioritize by risk
- mutation-testing - Validate test effectiveness
Remember
Systematic design > Random testing. 40+ years of research shows these techniques find more bugs with fewer tests than ad-hoc approaches.
Combine techniques for comprehensive coverage. BVA for boundaries, EP for partitions, decision tables for rules, pairwise for combinations.
With Agents: qe-test-generator applies these techniques automatically, generating optimal test suites with maximum coverage and minimum redundancy. Agents identify boundaries, partitions, and combinations from code analysis.
GitHub 仓库
相关推荐技能
regression-testing
其他该Skill提供智能化的回归测试策略,帮助开发者在验证代码修复时确保现有功能不被破坏。它通过变更影响分析和风险评估,智能选择测试用例并优化执行顺序,避免全量测试的时间消耗。适用于CI/CD流程中的测试套件规划、变更验证和快速反馈场景,能显著提升回归测试效率。
test-environment-management
其他该Skill专注于测试环境管理,提供基于基础设施即代码的自动化配置,支持使用Docker/Kubernetes确保环境一致性。它适用于创建与生产环境保持高度一致的测试环境,并通过服务虚拟化和成本优化策略来提升测试效率。开发者可用它来管理测试基础设施生命周期,优化资源使用成本。
localization-testing
其他该Skill为全球化产品提供国际化和本地化测试,特别适用于发布新市场或构建多语言产品。它能验证翻译覆盖、测试本地格式(日期/货币)、检查RTL布局和字符编码,并评估文化适应性。开发者可通过它系统检测本地化问题,确保产品符合不同区域的要求。
mutation-testing
其他该Skill通过变异测试评估测试套件的有效性,自动生成代码变异并计算杀灭率来验证测试质量。它适用于识别薄弱测试、证明测试能真正捕获bug,以及提升测试覆盖的可靠性。关键能力包括执行变异分析、定位存活变异,并提供具体的测试强化指导。
