Quality Engineering
Guidelines for QA processes, test automation, and performance engineering.
When to Use
- Designing test strategies for new features
- Setting up or improving test automation
- Performance testing and optimization
- Capacity planning and load testing
- Establishing quality metrics
Quality Philosophy
- Prevention over detection - Engage early to prevent defects
- Test behavior, not implementation - Focus on observable outcomes
- No failing builds - Never merge broken code
- Continuous improvement - Regularly refine processes
Test Strategy
Test Pyramid
/\
/E2E\ ← Few, critical paths
/------\
/ Integ \ ← Moderate, key integrations
/------------\
/ Unit \ ← Many, fast, isolated
Coverage Targets
- Unit tests: > 80% line coverage
- Integration: Key API paths covered
- E2E: Critical user journeys
Test Design Patterns
Arrange-Act-Assert (AAA)
// Arrange: Setup preconditions
const user = createTestUser();
// Act: Execute behavior
const result = await login(user);
// Assert: Verify outcome
expect(result.success).toBe(true);
Test Characteristics
- Isolated: No shared state between tests
- Deterministic: Same result every run
- Fast: Quick feedback loop
- Readable: Self-documenting names
Definition of Done
Feature is complete when:
Performance Engineering
Systematic Approach
- Baseline: Measure before optimizing
- Identify: Profile to find bottlenecks
- Budget: Set clear SLOs
- Optimize: Implement improvements
- Validate: Measure impact
- Monitor: Continuous production tracking
Key Metrics
| Layer |
Metrics |
| Frontend |
LCP, INP, CLS, TTFB |
| API |
Response time, throughput, error rate |
| Database |
Query time, connections, locks |
| Infrastructure |
CPU, memory, I/O, network |
Performance Checklist
Test Automation
Framework Selection
| Type |
Recommended Tools |
| Unit |
Jest, Pytest, JUnit |
| Integration |
Testcontainers, SuperTest |
| E2E |
Playwright, Cypress |
| Load |
k6, Locust, Gatling |
| Coverage |
Istanbul, JaCoCo |
CI/CD Integration
# Pipeline stages
stages:
- lint # Fast feedback
- unit # Parallel execution
- build # Artifact creation
- integration # Service testing
- e2e # Critical paths
- performance # Load testing (optional)
Test Data Management
- Use factories/fixtures for consistent data
- Isolate test data from production
- Clean up after tests
- Consider data masking for sensitive info
Quality Metrics
| Metric |
Target |
Purpose |
| Test Coverage |
> 80% |
Code confidence |
| Test Pass Rate |
> 98% |
Stability |
| Flaky Test Rate |
< 2% |
Reliability |
| Build Time |
< 10 min |
Fast feedback |
| MTTR |
< 1 hour |
Recovery speed |
Deliverables
- Test Strategy Document: Scope, objectives, methodology
- Test Cases: Step-by-step with expected results
- Automated Test Suite: Maintainable, organized tests
- CI Pipeline Config: Automated quality gates
- Coverage Reports: Visibility into tested code
- Performance Dashboards: Real-time metrics
- Bug Reports: Clear reproduction steps, severity
Anti-Patterns to Avoid
- Testing implementation details instead of behavior
- Flaky tests that pass/fail randomly
- Slow test suites blocking development
- Missing edge case coverage
- Manual-only regression testing
- No performance testing until production issues
1---2name: quality-engineering3description: Use when designing test strategies, implementing test automation, or optimizing performance4---5
6# Quality Engineering
7
8Guidelines for QA processes, test automation, and performance engineering.
9
10## When to Use
11
12- Designing test strategies for new features
13- Setting up or improving test automation
14- Performance testing and optimization
15- Capacity planning and load testing
16- Establishing quality metrics
17
18## Quality Philosophy
19
20- **Prevention over detection** - Engage early to prevent defects
21- **Test behavior, not implementation** - Focus on observable outcomes
22- **No failing builds** - Never merge broken code
23- **Continuous improvement** - Regularly refine processes
24
25## Test Strategy
26
27### Test Pyramid
28```
29 /\
30 /E2E\ ← Few, critical paths
31 /------\
32 / Integ \ ← Moderate, key integrations
33 /------------\
34 / Unit \ ← Many, fast, isolated
35```
36
37### Coverage Targets
38- Unit tests: > 80% line coverage
39- Integration: Key API paths covered
40- E2E: Critical user journeys
41
42## Test Design Patterns
43
44### Arrange-Act-Assert (AAA)
45```
46// Arrange: Setup preconditions
47const user = createTestUser();
48
49// Act: Execute behavior
50const result = await login(user);
51
52// Assert: Verify outcome
53expect(result.success).toBe(true);
54```
55
56### Test Characteristics
57- **Isolated**: No shared state between tests
58- **Deterministic**: Same result every run
59- **Fast**: Quick feedback loop
60- **Readable**: Self-documenting names
61
62## Definition of Done
63
64Feature is complete when:
65- [ ] All tests passing (unit, integration, E2E)
66- [ ] Code meets style guides
67- [ ] No console errors or unhandled exceptions
68- [ ] API changes documented
69- [ ] Performance budgets met
70
71## Performance Engineering
72
73### Systematic Approach
741. **Baseline**: Measure before optimizing
752. **Identify**: Profile to find bottlenecks
763. **Budget**: Set clear SLOs
774. **Optimize**: Implement improvements
785. **Validate**: Measure impact
796. **Monitor**: Continuous production tracking
80
81### Key Metrics
82
83| Layer | Metrics |
84|-------|---------|
85| Frontend | LCP, INP, CLS, TTFB |
86| API | Response time, throughput, error rate |
87| Database | Query time, connections, locks |
88| Infrastructure | CPU, memory, I/O, network |
89
90### Performance Checklist
91- [ ] Established performance baselines
92- [ ] Load testing simulates realistic traffic
93- [ ] Database queries optimized
94- [ ] Caching strategy implemented
95- [ ] CDN configured for static assets
96- [ ] Monitoring dashboards in place
97- [ ] Alerting on SLO breaches
98
99## Test Automation
100
101### Framework Selection
102
103| Type | Recommended Tools |
104|------|-------------------|
105| Unit | Jest, Pytest, JUnit |
106| Integration | Testcontainers, SuperTest |
107| E2E | Playwright, Cypress |
108| Load | k6, Locust, Gatling |
109| Coverage | Istanbul, JaCoCo |
110
111### CI/CD Integration
112```yaml
113# Pipeline stages
114stages:
115 - lint # Fast feedback
116 - unit # Parallel execution
117 - build # Artifact creation
118 - integration # Service testing
119 - e2e # Critical paths
120 - performance # Load testing (optional)
121```
122
123### Test Data Management
124- Use factories/fixtures for consistent data
125- Isolate test data from production
126- Clean up after tests
127- Consider data masking for sensitive info
128
129## Quality Metrics
130
131| Metric | Target | Purpose |
132|--------|--------|---------|
133| Test Coverage | > 80% | Code confidence |
134| Test Pass Rate | > 98% | Stability |
135| Flaky Test Rate | < 2% | Reliability |
136| Build Time | < 10 min | Fast feedback |
137| MTTR | < 1 hour | Recovery speed |
138
139## Deliverables
140
141- **Test Strategy Document**: Scope, objectives, methodology
142- **Test Cases**: Step-by-step with expected results
143- **Automated Test Suite**: Maintainable, organized tests
144- **CI Pipeline Config**: Automated quality gates
145- **Coverage Reports**: Visibility into tested code
146- **Performance Dashboards**: Real-time metrics
147- **Bug Reports**: Clear reproduction steps, severity
148
149## Anti-Patterns to Avoid
150
151- Testing implementation details instead of behavior
152- Flaky tests that pass/fail randomly
153- Slow test suites blocking development
154- Missing edge case coverage
155- Manual-only regression testing
156- No performance testing until production issues