Design optimal test pyramids with unit/integration/E2E ratios. Identify anti-patterns and recommend architecture-specific testing strategies.
Analyzes your architecture to design optimal test pyramids with proper unit/integration/E2E ratios. Identifies anti-patterns like ice cream cones and recommends architecture-specific testing strategies.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install test-strategy@melodic-softwareThis skill is limited to using the following tools:
Use this skill when:
The Test Pyramid, introduced by Mike Cohn, visualizes the ideal distribution of tests across different levels. More granular tests at the bottom (fast, cheap) and fewer broad tests at the top (slow, expensive).
┌───────┐
/ E2E \ ~10%
/ Tests \ (UI, Acceptance)
/─────────────\
/ Integration \ ~20%
/ Tests \ (API, Component)
/───────────────────\
/ Unit Tests \ ~70%
/ (Fast, Cheap) \ (Methods, Classes)
└─────────────────────────┘
| Level | Speed | Cost | Scope | Confidence | Maintenance |
|---|---|---|---|---|---|
| Unit | Fastest (ms) | Lowest | Single unit | Low | Low |
| Integration | Medium (s) | Medium | Components | Medium | Medium |
| E2E | Slowest (min) | Highest | Full system | High | High |
/\ Unit: 70%+
/ \ Integration: 20%
/ \ E2E: 10%
/ \
/________\ Fast feedback, low maintenance
Characteristics:
██████████ E2E: 60%
████████ Integration: 30%
████ Unit: 10%
Problems:
Fix: Extract unit tests, reduce E2E scope
██████████ E2E: 40%
██████████ Manual: 50%
████ Unit: 10%
Problems:
Fix: Automate critical paths, add integration layer
██ E2E: 10%
██████████ Integration: 70%
██ Unit: 20%
Problems:
Fix: Push coverage down to unit level
/\ Unit: 70%
/ \ Integration: 20%
/ \ E2E: 10%
/______\
Focus on unit tests for business logic.
/\ E2E/Contract: 10%
/ \ Integration: 30%
/ \ Unit: 60%
/______\
More integration tests for service boundaries. Add contract tests between services.
/\ E2E: 10%
/ \ Integration: 35%
/ \ Unit: 55%
/______\
Integration tests for event handlers. Unit tests for event processing logic.
/\ E2E: 15%
/ \ Integration: 25%
/ \ Unit/Component: 60%
/______\
Component tests replace some unit tests. Visual regression testing at integration level.
Alternative for frontend applications:
┌─────┐
│ E2E │ ~5%
┌──┴─────┴──┐
│Integration│ ~50%
┌──┴───────────┴──┐
│ Static │ ~10%
┌──┴─────────────────┴──┐
│ Unit │ ~35%
└────────────────────────┘
Count tests by level:
Level | Count | % Total | Time | Pass Rate
-------------|-------|---------|---------|----------
E2E | 150 | 45% | 30 min | 85%
Integration | 100 | 30% | 10 min | 95%
Unit | 80 | 25% | 30 sec | 99%
| If You Have... | Shape | Priority Fix |
|---|---|---|
| E2E > 30% | Ice Cream Cone | Extract to lower levels |
| Unit < 50% | Inverted | Add unit tests for logic |
| Integration > 50% | Hourglass | Push to unit level |
| Manual > 20% | Cupcake | Automate critical paths |
Based on architecture:
| Architecture | Unit | Integration | E2E |
|---|---|---|---|
| Monolith | 70% | 20% | 10% |
| Microservices | 60% | 30% | 10% |
| Serverless | 50% | 40% | 10% |
| Frontend SPA | 40% | 45% | 15% |
Prioritize by ROI:
Should test:
Should NOT test:
Should test:
Should NOT test:
Should test:
Should NOT test:
src/
MyApp.Domain/ # Business logic
MyApp.Application/ # Use cases
MyApp.Infrastructure/ # Data access
MyApp.Api/ # HTTP endpoints
tests/
MyApp.Domain.Tests/ # Unit tests (70%)
Features/
Orders/
CreateOrderTests.cs
OrderValidationTests.cs
MyApp.Application.Tests/ # Integration tests (20%)
Features/
Orders/
CreateOrderHandlerTests.cs
MyApp.Api.Tests/ # E2E tests (10%)
Features/
Orders/
OrdersEndpointTests.cs
// Build script or CI check
public class TestDistributionTests
{
[Fact]
public void TestPyramidRatiosAreHealthy()
{
var unitTests = CountTestsInAssembly("MyApp.Domain.Tests");
var integrationTests = CountTestsInAssembly("MyApp.Application.Tests");
var e2eTests = CountTestsInAssembly("MyApp.Api.Tests");
var total = unitTests + integrationTests + e2eTests;
Assert.True(unitTests / total >= 0.60, "Unit tests should be ≥60%");
Assert.True(e2eTests / total <= 0.15, "E2E tests should be ≤15%");
}
}
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Unit test time | < 1 min | 1-5 min | > 5 min |
| Integration time | < 5 min | 5-15 min | > 15 min |
| E2E test time | < 10 min | 10-30 min | > 30 min |
| Flaky test rate | < 1% | 1-5% | > 5% |
Track coverage by pyramid level:
Inputs from:
Outputs to:
test-strategy-planning skill → Strategy documentautomation-strategy skill → Automation scopeUse when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.