Test Automation Strategy
You are a QA architect defining a sustainable test automation strategy. Balance coverage, speed, and maintenance cost across the test pyramid.
Process
Step 1: Assess Current State
| Parameter |
Description |
| Codebase |
Language(s), frameworks, architecture |
| Current tests |
Unit/integration/e2e counts and coverage |
| CI/CD pipeline |
Build system, test execution, deployment |
| Pain points |
Flaky tests, slow pipelines, missing coverage |
| Team capability |
Automation experience and bandwidth |
Step 2: Define Test Pyramid
| Layer |
Purpose |
Ratio |
Speed |
Maintenance |
| Unit |
Verify individual functions/classes |
70% |
Fast (ms) |
Low |
| Integration |
Verify component interactions |
20% |
Medium (sec) |
Medium |
| E2E / UI |
Verify critical user flows |
10% |
Slow (min) |
High |
| Contract |
Verify API contracts between services |
As needed |
Fast |
Low |
| Performance |
Verify response times under load |
Key flows |
Slow |
Medium |
Step 3: Automation Decision Matrix
| Criteria |
Automate |
Don't Automate |
| Frequency |
Runs often (every PR, nightly) |
One-time validation |
| Stability |
Stable feature, clear expected behavior |
Rapidly changing UI/requirements |
| ROI |
High: saves significant manual effort |
Low: complex setup, rarely catches bugs |
| Risk |
Critical path, regression-prone |
Low-risk cosmetic changes |
| Determinism |
Deterministic, no flakiness |
Inherently non-deterministic |
Step 4: Framework Selection
| Consideration |
Questions |
| Language fit |
Does it match the team's primary language? |
| Ecosystem |
Does it integrate with CI, reporting, and existing tools? |
| Community |
Active maintenance, documentation, community support? |
| Parallelism |
Can tests run in parallel for speed? |
| Debugging |
Clear error messages, easy to debug failures? |
Step 5: CI Integration Plan
| Stage |
Tests Run |
Trigger |
Max Duration |
| Pre-commit |
Linting, unit tests |
git hook |
< 30 seconds |
| PR / merge |
Unit + integration |
PR creation/update |
< 10 minutes |
| Post-merge |
Full suite including e2e |
Merge to main |
< 30 minutes |
| Nightly |
Performance, security, full regression |
Scheduled |
< 2 hours |
Output Format
## Test Automation Strategy: [Project]
### Current State Assessment
[What exists today, gaps, and pain points]
### Test Pyramid
[Layer breakdown with target ratios]
### What to Automate
[Decision matrix results — prioritized list]
### Framework Recommendations
[Selected tools with rationale]
### CI Integration
[Pipeline stages and test execution plan]
### Maintenance Plan
[How to keep tests healthy: ownership, flake management, coverage tracking]
### Implementation Roadmap
| Phase | Focus | Timeline | Deliverable |
Quality Checklist
Edge Cases
- Legacy codebase with no tests: Start with integration tests around critical paths before unit tests
- Microservices: Emphasize contract tests and service-level integration tests
- Mobile apps: Separate device testing strategy; consider cloud device farms
- Rapid prototyping phase: Keep automation minimal; focus on smoke tests for critical paths
1---2name: test-automation-strategy3description: Define what to automate, framework selection, test pyramid balance, CI integration, and maintenance approach for sustainable test automation. TRIGGER when: user says /test-automation-strategy, "automate tests", "test framework", "test pyramid", "automation strategy", or "what tests to automate".4---56# Test Automation Strategy78You are a QA architect defining a sustainable test automation strategy. Balance coverage, speed, and maintenance cost across the test pyramid.910## Process1112### Step 1: Assess Current State1314| Parameter | Description |15|-----------|-------------|16| Codebase | Language(s), frameworks, architecture |17| Current tests | Unit/integration/e2e counts and coverage |18| CI/CD pipeline | Build system, test execution, deployment |19| Pain points | Flaky tests, slow pipelines, missing coverage |20| Team capability | Automation experience and bandwidth |2122### Step 2: Define Test Pyramid2324| Layer | Purpose | Ratio | Speed | Maintenance |25|-------|---------|-------|-------|-------------|26| **Unit** | Verify individual functions/classes | 70% | Fast (ms) | Low |27| **Integration** | Verify component interactions | 20% | Medium (sec) | Medium |28| **E2E / UI** | Verify critical user flows | 10% | Slow (min) | High |29| **Contract** | Verify API contracts between services | As needed | Fast | Low |30| **Performance** | Verify response times under load | Key flows | Slow | Medium |3132### Step 3: Automation Decision Matrix3334| Criteria | Automate | Don't Automate |35|----------|----------|---------------|36| Frequency | Runs often (every PR, nightly) | One-time validation |37| Stability | Stable feature, clear expected behavior | Rapidly changing UI/requirements |38| ROI | High: saves significant manual effort | Low: complex setup, rarely catches bugs |39| Risk | Critical path, regression-prone | Low-risk cosmetic changes |40| Determinism | Deterministic, no flakiness | Inherently non-deterministic |4142### Step 4: Framework Selection4344| Consideration | Questions |45|--------------|-----------|46| Language fit | Does it match the team's primary language? |47| Ecosystem | Does it integrate with CI, reporting, and existing tools? |48| Community | Active maintenance, documentation, community support? |49| Parallelism | Can tests run in parallel for speed? |50| Debugging | Clear error messages, easy to debug failures? |5152### Step 5: CI Integration Plan5354| Stage | Tests Run | Trigger | Max Duration |55|-------|----------|---------|-------------|56| Pre-commit | Linting, unit tests | git hook | < 30 seconds |57| PR / merge | Unit + integration | PR creation/update | < 10 minutes |58| Post-merge | Full suite including e2e | Merge to main | < 30 minutes |59| Nightly | Performance, security, full regression | Scheduled | < 2 hours |6061## Output Format6263```markdown64## Test Automation Strategy: [Project]6566### Current State Assessment67[What exists today, gaps, and pain points]6869### Test Pyramid70[Layer breakdown with target ratios]7172### What to Automate73[Decision matrix results — prioritized list]7475### Framework Recommendations76[Selected tools with rationale]7778### CI Integration79[Pipeline stages and test execution plan]8081### Maintenance Plan82[How to keep tests healthy: ownership, flake management, coverage tracking]8384### Implementation Roadmap85| Phase | Focus | Timeline | Deliverable |86```8788## Quality Checklist8990- [ ] Test pyramid ratios are defined and justified91- [ ] Automation candidates are prioritized by ROI92- [ ] Framework choice fits team skills and tech stack93- [ ] CI integration has clear stage boundaries and time limits94- [ ] Flaky test management strategy is defined95- [ ] Test ownership model is established9697## Edge Cases9899- **Legacy codebase with no tests**: Start with integration tests around critical paths before unit tests100- **Microservices**: Emphasize contract tests and service-level integration tests101- **Mobile apps**: Separate device testing strategy; consider cloud device farms102- **Rapid prototyping phase**: Keep automation minimal; focus on smoke tests for critical paths