ai-flow-dev 2.2.0 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -24
- package/dist/cli.js +228 -418
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/prompts/backend/flow-build-phase-0.md +286 -4
- package/prompts/backend/flow-build-phase-1.md +19 -0
- package/prompts/backend/flow-build-phase-2.md +19 -0
- package/prompts/backend/flow-build-phase-3.md +19 -0
- package/prompts/backend/flow-build-phase-4.md +19 -0
- package/prompts/backend/flow-build-phase-5.md +19 -0
- package/prompts/backend/flow-build-phase-6.md +19 -0
- package/prompts/backend/flow-build-phase-7.md +19 -0
- package/prompts/backend/flow-build-phase-9.md +14 -0
- package/prompts/backend/flow-build.md +2 -0
- package/prompts/backend/flow-check-review.md +20 -0
- package/prompts/backend/flow-check-test.md +14 -0
- package/prompts/backend/flow-check.md +67 -0
- package/prompts/backend/flow-commit.md +53 -0
- package/prompts/backend/flow-docs-sync.md +55 -53
- package/prompts/backend/flow-work-feature.md +42 -0
- package/prompts/backend/flow-work-fix.md +33 -0
- package/prompts/backend/flow-work-refactor.md +32 -0
- package/prompts/backend/flow-work-resume.md +32 -0
- package/prompts/backend/flow-work.md +129 -0
- package/prompts/frontend/flow-build-phase-0.md +363 -35
- package/prompts/frontend/flow-build-phase-1.md +433 -404
- package/prompts/frontend/flow-build-phase-2.md +508 -872
- package/prompts/frontend/flow-build-phase-3.md +629 -562
- package/prompts/frontend/flow-build-phase-4.md +438 -382
- package/prompts/frontend/flow-build-phase-5.md +559 -362
- package/prompts/frontend/flow-build-phase-6.md +383 -452
- package/prompts/frontend/flow-build-phase-7.md +818 -392
- package/prompts/frontend/flow-build-phase-9.md +14 -0
- package/prompts/frontend/flow-build.md +2 -0
- package/prompts/frontend/flow-check-review.md +20 -0
- package/prompts/frontend/flow-check-test.md +14 -0
- package/prompts/frontend/flow-check.md +67 -0
- package/prompts/frontend/flow-commit.md +53 -0
- package/prompts/frontend/flow-docs-sync.md +39 -35
- package/prompts/frontend/flow-work-feature.md +42 -0
- package/prompts/frontend/flow-work-fix.md +33 -0
- package/prompts/frontend/flow-work-refactor.md +32 -0
- package/prompts/frontend/flow-work-resume.md +32 -0
- package/prompts/frontend/flow-work.md +129 -0
- package/prompts/mobile/flow-build-phase-0.md +366 -37
- package/prompts/mobile/flow-build-phase-1.md +438 -493
- package/prompts/mobile/flow-build-phase-2.md +458 -464
- package/prompts/mobile/flow-build-phase-3.md +613 -487
- package/prompts/mobile/flow-build-phase-4.md +439 -258
- package/prompts/mobile/flow-build-phase-5.md +582 -250
- package/prompts/mobile/flow-build-phase-6.md +389 -359
- package/prompts/mobile/flow-build-phase-7.md +871 -285
- package/prompts/mobile/flow-build-phase-9.md +14 -0
- package/prompts/mobile/flow-build.md +2 -0
- package/prompts/mobile/flow-check-review.md +20 -0
- package/prompts/mobile/flow-check-test.md +14 -0
- package/prompts/mobile/flow-check.md +67 -0
- package/prompts/mobile/flow-commit.md +53 -0
- package/prompts/mobile/flow-docs-sync.md +39 -40
- package/prompts/mobile/flow-work-feature.md +42 -0
- package/prompts/mobile/flow-work-fix.md +33 -0
- package/prompts/mobile/flow-work-refactor.md +32 -0
- package/prompts/mobile/flow-work-resume.md +32 -0
- package/prompts/mobile/flow-work.md +129 -0
- package/prompts/shared/smart-skip-preflight.md +214 -0
- package/templates/AGENT.template.md +13 -3
- package/templates/backend/.clauderules.template +5 -4
- package/templates/backend/.cursorrules.template +1 -1
- package/prompts/backend/flow-dev-commit.md +0 -829
- package/prompts/backend/flow-dev-feature.md +0 -1948
- package/prompts/backend/flow-dev-fix.md +0 -952
- package/prompts/backend/flow-dev-refactor.md +0 -690
- package/prompts/backend/flow-dev-review.md +0 -372
- package/prompts/backend/flow-dev-work.md +0 -1081
|
@@ -1,494 +1,524 @@
|
|
|
1
|
-
|
|
1
|
+
## PHASE 6: Testing Strategy (15-20 min)
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
> **Order for this phase:**
|
|
4
|
+
>
|
|
5
|
+
> - **MVP:** 6.1 → 6.2 (smoke tests) → 6.7 (CI basics)
|
|
6
|
+
> - **Production-Ready:** 6.1 → 6.1b → 6.2 → 6.3 → 6.4 → 6.5 → 6.6 → 6.7
|
|
7
|
+
> - **Enterprise:** 6.1 → 6.1b → 6.2 → 6.3 → 6.4 → 6.5 → 6.6 → 6.7 → 6.8 → 6.9
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
> **📌 Scope-based behavior:**
|
|
10
|
+
>
|
|
11
|
+
> - **MVP:** Ask 6.1 (framework), 6.2 (smoke tests only), 6.7 (CI basics) - **Target: 15-25% coverage**
|
|
12
|
+
> - **Production-Ready:** Ask all questions 6.1-6.7 - **Target: 60-80% coverage**
|
|
13
|
+
> - **Enterprise:** Ask all questions 6.1-6.9 - **Target: 80-95% coverage + contract/load tests**
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
2. What types of tests will you write?
|
|
13
|
-
3. How will you test on devices/emulators?
|
|
14
|
-
4. What coverage targets?
|
|
15
|
-
5. How will tests run in CI/CD?
|
|
16
|
-
---
|
|
17
|
-
## 📋 Questions
|
|
15
|
+
### Objective
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Define testing approach, tools, and quality gates.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
**🚨 Important: All projects require basic testing. Scope determines depth, not whether to test.**
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
---
|
|
24
22
|
|
|
25
|
-
-
|
|
26
|
-
- Built-in with React Native
|
|
27
|
-
- Snapshot testing
|
|
28
|
-
- Best for: Most React Native apps
|
|
23
|
+
## 🔍 Pre-Flight Check (Smart Skip Logic)
|
|
29
24
|
|
|
30
|
-
-
|
|
31
|
-
- Faster, ESM native
|
|
32
|
-
- Best for: Modern setups
|
|
25
|
+
> 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
|
|
33
26
|
|
|
34
|
-
**
|
|
27
|
+
**Execute Pre-Flight Check for Phase 6:**
|
|
35
28
|
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
- **Target File**: `docs/testing.md`
|
|
30
|
+
- **Phase Name**: "TESTING STRATEGY"
|
|
31
|
+
- **Key Items**: Test framework, coverage targets, test types, CI/CD integration
|
|
32
|
+
- **Typical Gaps**: E2E strategy, load testing, performance testing
|
|
40
33
|
|
|
41
|
-
**
|
|
34
|
+
**Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
- Unit tests
|
|
45
|
-
- UI tests
|
|
46
|
-
- Best for: All iOS apps
|
|
36
|
+
---
|
|
47
37
|
|
|
48
|
-
|
|
38
|
+
## Phase 6 Questions (Full Mode)
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
- Unit tests
|
|
52
|
-
- Best for: All Android apps
|
|
40
|
+
**6.1 Testing Framework**
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
### Question 6.2: Component/Screen Testing
|
|
57
|
-
|
|
58
|
-
**How will you test components and screens?**
|
|
59
|
-
|
|
60
|
-
**If React Native:**
|
|
61
|
-
|
|
62
|
-
- A) ⭐ **React Native Testing Library** (Recommended)
|
|
63
|
-
- User-centric testing
|
|
64
|
-
- Accessible queries
|
|
65
|
-
- Best for: All React Native apps
|
|
66
|
-
|
|
67
|
-
**If Flutter:**
|
|
68
|
-
|
|
69
|
-
- A) ⭐ **Widget Testing** (Built-in)
|
|
70
|
-
- Test widgets in isolation
|
|
71
|
-
- Best for: All Flutter apps
|
|
72
|
-
|
|
73
|
-
**If Native iOS:**
|
|
74
|
-
|
|
75
|
-
- A) ⭐ **XCUITest** (Built-in)
|
|
76
|
-
- UI testing framework
|
|
77
|
-
- Best for: All iOS apps
|
|
78
|
-
|
|
79
|
-
**If Native Android:**
|
|
80
|
-
|
|
81
|
-
- A) ⭐ **Espresso** (Recommended)
|
|
82
|
-
- UI testing framework
|
|
83
|
-
- Best for: All Android apps
|
|
84
|
-
|
|
85
|
-
**Your answer:**
|
|
86
|
-
---
|
|
87
|
-
### Question 6.3: E2E Testing Framework
|
|
88
|
-
|
|
89
|
-
**What E2E testing tool will you use?**
|
|
90
|
-
|
|
91
|
-
**If React Native:**
|
|
42
|
+
```
|
|
92
43
|
|
|
93
|
-
|
|
94
|
-
- Gray-box E2E testing
|
|
95
|
-
- Works with iOS and Android
|
|
96
|
-
- Best for: Most React Native apps
|
|
44
|
+
Which testing tools will you use?
|
|
97
45
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
46
|
+
JavaScript/TypeScript:
|
|
47
|
+
A) ⭐ Jest - Most popular, great ecosystem
|
|
48
|
+
B) Vitest - Modern, fast, Vite-compatible
|
|
49
|
+
C) Mocha + Chai
|
|
50
|
+
D) AVA
|
|
102
51
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
52
|
+
Python:
|
|
53
|
+
E) ⭐ pytest - Modern, feature-rich
|
|
54
|
+
F) unittest - Built-in
|
|
55
|
+
G) nose2
|
|
107
56
|
|
|
108
|
-
|
|
57
|
+
Java:
|
|
58
|
+
H) ⭐ JUnit 5 + Mockito
|
|
59
|
+
I) TestNG
|
|
109
60
|
|
|
110
|
-
|
|
111
|
-
- Flutter's integration testing
|
|
112
|
-
- Best for: Most Flutter apps
|
|
61
|
+
Your choice: \_\_
|
|
113
62
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- Best for: Simple E2E flows
|
|
63
|
+
Assertion library: **
|
|
64
|
+
Mocking library: **
|
|
117
65
|
|
|
118
|
-
|
|
66
|
+
```
|
|
119
67
|
|
|
120
|
-
|
|
121
|
-
- Cross-platform
|
|
122
|
-
- Works with iOS and Android
|
|
123
|
-
- Best for: Native apps
|
|
68
|
+
**6.1b Testing Philosophy** (Production-Ready and Enterprise only)
|
|
124
69
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
### Question 6.4: Testing on Physical Devices
|
|
70
|
+
```
|
|
71
|
+
What is your testing philosophy?
|
|
128
72
|
|
|
129
|
-
|
|
73
|
+
A) ⭐ Test-First (TDD) - Write tests before code
|
|
74
|
+
- Red-Green-Refactor cycle
|
|
75
|
+
- Higher initial effort, better design
|
|
76
|
+
- Best for: Complex business logic, critical systems
|
|
130
77
|
|
|
131
|
-
|
|
78
|
+
B) 🔥 Test-After - Write tests after implementation
|
|
79
|
+
- Faster initial development
|
|
80
|
+
- Risk of untested edge cases
|
|
81
|
+
- Best for: Rapid prototyping, time-sensitive features
|
|
132
82
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
83
|
+
C) ⚡ Behavior-Driven (BDD) - Write tests as specifications
|
|
84
|
+
- Given/When/Then format
|
|
85
|
+
- Business-readable tests
|
|
86
|
+
- Best for: Domain-heavy applications
|
|
135
87
|
|
|
136
|
-
|
|
88
|
+
D) 🏆 Hybrid - TDD for core logic, test-after for simple features
|
|
89
|
+
- Balance of speed and quality
|
|
90
|
+
- Pragmatic approach
|
|
137
91
|
|
|
138
|
-
|
|
139
|
-
|
|
92
|
+
Your choice: __
|
|
93
|
+
```
|
|
140
94
|
|
|
141
|
-
|
|
95
|
+
**6.2 Test Types**
|
|
142
96
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- Sauce Labs
|
|
146
|
-
- Best for: Multiple device testing
|
|
97
|
+
```
|
|
98
|
+
[If MVP scope selected, ask simplified version:]
|
|
147
99
|
|
|
148
|
-
|
|
100
|
+
For MVP, we'll focus on smoke tests (critical path verification).
|
|
101
|
+
Which critical flows should be tested?
|
|
149
102
|
|
|
150
|
-
-
|
|
151
|
-
|
|
103
|
+
Select 3-5 most important endpoints/features:
|
|
104
|
+
A) Authentication (login/register)
|
|
105
|
+
B) Main business operation (e.g., create order, post article)
|
|
106
|
+
C) User profile/account management
|
|
107
|
+
D) Payment processing (if applicable)
|
|
108
|
+
E) Data retrieval (main GET endpoints)
|
|
152
109
|
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
### Question 6.5: Emulator/Simulator Strategy
|
|
110
|
+
Selected: __
|
|
156
111
|
|
|
157
|
-
|
|
112
|
+
Test approach: Integration tests covering happy path of selected flows
|
|
113
|
+
Coverage target: 15-25%
|
|
114
|
+
Test type: Integration/E2E only (no unit tests required for MVP)
|
|
158
115
|
|
|
159
|
-
|
|
116
|
+
[If Production-Ready or Enterprise scope selected, ask full version:]
|
|
160
117
|
|
|
161
|
-
|
|
162
|
-
- Run tests in CI with emulators
|
|
163
|
-
- Best for: Most teams
|
|
118
|
+
Which test types will you implement?
|
|
164
119
|
|
|
165
|
-
|
|
120
|
+
A) ✅ Unit Tests
|
|
121
|
+
- Test individual functions/methods in isolation
|
|
122
|
+
- Fast, numerous
|
|
123
|
+
- Mock all dependencies
|
|
166
124
|
|
|
167
|
-
|
|
168
|
-
-
|
|
125
|
+
B) ✅ Integration Tests
|
|
126
|
+
- Test multiple components together
|
|
127
|
+
- Database, external APIs
|
|
128
|
+
- Slower but more realistic
|
|
169
129
|
|
|
170
|
-
C)
|
|
130
|
+
C) ✅ E2E (End-to-End) Tests
|
|
131
|
+
- Test full user flows
|
|
132
|
+
- API endpoints from request to response
|
|
133
|
+
- Tool: Supertest (Node.js), pytest with TestClient (Python)
|
|
171
134
|
|
|
172
|
-
|
|
173
|
-
-
|
|
135
|
+
D) 🏆 Contract Tests (Advanced - Enterprise recommended)
|
|
136
|
+
- Verify API contracts between services
|
|
137
|
+
- Tool: Pact, Spring Cloud Contract
|
|
174
138
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
### Question 6.6: Testing Pyramid Distribution
|
|
139
|
+
E) ⚡ Load/Performance Tests (Enterprise recommended)
|
|
140
|
+
- Tool: Artillery, K6, JMeter
|
|
178
141
|
|
|
179
|
-
|
|
142
|
+
F) 🔬 Chaos Engineering (Enterprise only)
|
|
143
|
+
- Test system resilience to failures
|
|
144
|
+
- Tool: Chaos Monkey, Litmus, Gremlin
|
|
180
145
|
|
|
181
|
-
|
|
146
|
+
Selected: __
|
|
182
147
|
|
|
148
|
+
Pyramid distribution:
|
|
183
149
|
- 70% Unit tests
|
|
184
150
|
- 20% Integration tests
|
|
185
151
|
- 10% E2E tests
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
B) **Heavy Unit**
|
|
152
|
+
(Adjust as needed)
|
|
189
153
|
|
|
190
|
-
|
|
191
|
-
- 10% Integration tests
|
|
192
|
-
- 5% E2E tests
|
|
193
|
-
- Best for: Logic-heavy apps
|
|
154
|
+
```
|
|
194
155
|
|
|
195
|
-
|
|
156
|
+
**6.3 Test Database** [Skip if MVP scope]
|
|
196
157
|
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
- 10% E2E tests
|
|
200
|
-
- Best for: UI-heavy apps
|
|
158
|
+
```
|
|
159
|
+
[Production-Ready/Enterprise only]
|
|
201
160
|
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
#### 🎨 MOBILE TESTING PYRAMID VISUALIZATION
|
|
161
|
+
How will you handle database in tests?
|
|
205
162
|
|
|
206
|
-
|
|
163
|
+
A) ⭐ In-memory database
|
|
164
|
+
- SQLite for testing, PostgreSQL for prod
|
|
165
|
+
- Fast, isolated
|
|
207
166
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
INT["🔗 Integration Tests (20%)<br/>Component + API<br/>Medium Speed<br/>Screen rendering + navigation"]
|
|
213
|
-
UNIT["⚡ Unit Tests (70%)<br/>Jest/XCTest<br/>Fast, Cheap<br/>Business logic, hooks, utilities"]
|
|
214
|
-
end
|
|
167
|
+
B) 🏆 Docker test database
|
|
168
|
+
- Same DB as production
|
|
169
|
+
- More realistic
|
|
170
|
+
- Tool: Testcontainers
|
|
215
171
|
|
|
216
|
-
|
|
217
|
-
|
|
172
|
+
C) 🔄 Shared test database
|
|
173
|
+
- One DB for all tests
|
|
174
|
+
- Reset between test suites
|
|
218
175
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
176
|
+
D) 🎭 Mock database
|
|
177
|
+
- Mock all DB calls
|
|
178
|
+
- Fastest, but less realistic
|
|
222
179
|
|
|
223
|
-
|
|
180
|
+
Your choice: __
|
|
224
181
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
182
|
+
Test data strategy:
|
|
183
|
+
A) ⭐ Factories/Fixtures - Generate test data programmatically
|
|
184
|
+
B) Seed files - Load from JSON/SQL files
|
|
185
|
+
C) Inline - Create data in each test
|
|
228
186
|
|
|
229
|
-
E2E -.-> note1
|
|
230
|
-
INT -.-> note2
|
|
231
|
-
UNIT -.-> note3
|
|
232
187
|
```
|
|
233
188
|
|
|
234
|
-
**
|
|
235
|
-
|
|
236
|
-
```mermaid
|
|
237
|
-
graph TB
|
|
238
|
-
subgraph "Mobile Test Types"
|
|
239
|
-
E2E_LAYER["E2E Layer<br/>Detox, Maestro, Appium"]
|
|
240
|
-
SCREEN_LAYER["Screen Tests<br/>React Native Testing Library<br/>Flutter Widget Tests"]
|
|
241
|
-
COMPONENT_LAYER["Component Tests<br/>Rendering, Props, Events"]
|
|
242
|
-
LOGIC_LAYER["Unit Tests<br/>Hooks, Utils, State Logic"]
|
|
243
|
-
STATIC_LAYER["Static Analysis<br/>TypeScript, ESLint"]
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
E2E_LAYER --> SCREEN_LAYER
|
|
247
|
-
SCREEN_LAYER --> COMPONENT_LAYER
|
|
248
|
-
COMPONENT_LAYER --> LOGIC_LAYER
|
|
249
|
-
LOGIC_LAYER --> STATIC_LAYER
|
|
250
|
-
|
|
251
|
-
DEVICES["Real Devices<br/>iOS + Android"]
|
|
252
|
-
EMULATORS["Emulators/Simulators<br/>Fast feedback"]
|
|
253
|
-
|
|
254
|
-
E2E_LAYER -.->|Run on| DEVICES
|
|
255
|
-
SCREEN_LAYER -.->|Run on| EMULATORS
|
|
256
|
-
|
|
257
|
-
style E2E_LAYER fill:#fce4ec,stroke:#c2185b,stroke-width:2px
|
|
258
|
-
style SCREEN_LAYER fill:#fff4e6,stroke:#f57c00,stroke-width:2px
|
|
259
|
-
style COMPONENT_LAYER fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
|
|
260
|
-
style LOGIC_LAYER fill:#e1f5ff,stroke:#1976d2,stroke-width:2px
|
|
261
|
-
style STATIC_LAYER fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
|
|
189
|
+
**6.4 Test Data Management** [Skip if MVP scope]
|
|
190
|
+
|
|
262
191
|
```
|
|
192
|
+
[Production-Ready/Enterprise only]
|
|
263
193
|
|
|
264
|
-
|
|
194
|
+
How will you create test data?
|
|
265
195
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
SHARED[Shared Business Logic<br/>Unit Tests (Jest)]
|
|
270
|
-
RN_SCREEN[React Native<br/>Screen Tests]
|
|
271
|
-
FLUTTER_WIDGET[Flutter<br/>Widget Tests]
|
|
272
|
-
end
|
|
196
|
+
A) ⭐ Factory pattern
|
|
197
|
+
- Libraries: factory_boy (Python), Fishery (TypeScript)
|
|
198
|
+
- Generate realistic data on demand
|
|
273
199
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
end
|
|
200
|
+
B) Fixtures
|
|
201
|
+
- Predefined test data
|
|
202
|
+
- Loaded before tests
|
|
278
203
|
|
|
279
|
-
|
|
280
|
-
|
|
204
|
+
C) Faker
|
|
205
|
+
- Random realistic data
|
|
206
|
+
- Library: @faker-js/faker, Faker (Python)
|
|
281
207
|
|
|
282
|
-
|
|
283
|
-
RN_SCREEN --> ANDROID_E2E
|
|
208
|
+
Your approach: __
|
|
284
209
|
|
|
285
|
-
|
|
286
|
-
|
|
210
|
+
Example test data needs:
|
|
211
|
+
- Users with various roles
|
|
212
|
+
- Products with different states
|
|
213
|
+
- Orders in different stages
|
|
214
|
+
- Payment records
|
|
215
|
+
- [Add your specific needs]
|
|
287
216
|
|
|
288
|
-
style SHARED fill:#e8f5e9
|
|
289
|
-
style RN_SCREEN fill:#e1f5ff
|
|
290
|
-
style FLUTTER_WIDGET fill:#e1f5ff
|
|
291
|
-
style IOS_E2E fill:#fce4ec
|
|
292
|
-
style ANDROID_E2E fill:#fff4e6
|
|
293
217
|
```
|
|
294
218
|
|
|
295
|
-
**
|
|
219
|
+
**6.5 Mocking Strategy** [Skip if MVP scope]
|
|
296
220
|
|
|
297
|
-
|
|
298
|
-
-
|
|
299
|
-
- **Cross-Platform**: Best for React Native/Flutter apps with shared logic
|
|
221
|
+
```
|
|
222
|
+
[Production-Ready/Enterprise only]
|
|
300
223
|
|
|
301
|
-
|
|
224
|
+
What will you mock?
|
|
302
225
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
### Question 6.7: Code Coverage Targets
|
|
226
|
+
A) ✅ External APIs - Third-party services
|
|
227
|
+
B) ✅ Database - In unit tests
|
|
228
|
+
C) ✅ File system - S3, local storage
|
|
229
|
+
D) ✅ Time/Date - For deterministic tests
|
|
230
|
+
E) ✅ Email/SMS - Sending services
|
|
231
|
+
F) ✅ Payment gateways
|
|
311
232
|
|
|
312
|
-
|
|
233
|
+
Mocking approach:
|
|
234
|
+
A) ⭐ Manual mocks - jest.fn(), unittest.mock
|
|
235
|
+
B) Library - MSW (Mock Service Worker), nock
|
|
236
|
+
C) Test doubles - Stubs, spies, mocks
|
|
313
237
|
|
|
314
|
-
|
|
238
|
+
When NOT to mock:
|
|
239
|
+
- Internal business logic
|
|
240
|
+
- Simple utilities
|
|
241
|
+
- Value objects
|
|
315
242
|
|
|
316
|
-
|
|
317
|
-
- 70% branch coverage
|
|
318
|
-
- Best for: Most apps
|
|
243
|
+
```
|
|
319
244
|
|
|
320
|
-
|
|
245
|
+
**6.6 Test Organization** [Skip if MVP scope]
|
|
321
246
|
|
|
322
|
-
|
|
323
|
-
-
|
|
324
|
-
- Best for: Critical apps
|
|
247
|
+
```
|
|
248
|
+
[Production-Ready/Enterprise only]
|
|
325
249
|
|
|
326
|
-
|
|
250
|
+
Test file structure:
|
|
327
251
|
|
|
328
|
-
-
|
|
329
|
-
|
|
330
|
-
- Best for: MVPs, small apps
|
|
252
|
+
A) ⭐ Co-located with source
|
|
253
|
+
```
|
|
331
254
|
|
|
332
|
-
|
|
255
|
+
src/
|
|
256
|
+
users/
|
|
257
|
+
user.service.ts
|
|
258
|
+
user.service.spec.ts
|
|
333
259
|
|
|
334
|
-
|
|
335
|
-
- Best for: Very small projects
|
|
260
|
+
```
|
|
336
261
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
### Question 6.8: Snapshot Testing
|
|
262
|
+
B) Separate test directory
|
|
263
|
+
```
|
|
340
264
|
|
|
341
|
-
|
|
265
|
+
src/users/user.service.ts
|
|
266
|
+
tests/users/user.service.test.ts
|
|
342
267
|
|
|
343
|
-
|
|
268
|
+
````
|
|
344
269
|
|
|
345
|
-
|
|
346
|
-
- Catch unintended UI changes
|
|
347
|
-
- Best for: Component regression testing
|
|
270
|
+
Test naming:
|
|
348
271
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
272
|
+
```typescript
|
|
273
|
+
describe('UserService', () => {
|
|
274
|
+
describe('createUser', () => {
|
|
275
|
+
it('should create a new user with valid data', async () => {
|
|
276
|
+
// Arrange
|
|
277
|
+
const userData = { email: 'test@example.com', name: 'Test' };
|
|
352
278
|
|
|
353
|
-
|
|
279
|
+
// Act
|
|
280
|
+
const result = await userService.createUser(userData);
|
|
354
281
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
282
|
+
// Assert
|
|
283
|
+
expect(result).toBeDefined();
|
|
284
|
+
expect(result.email).toBe(userData.email);
|
|
285
|
+
});
|
|
358
286
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
287
|
+
it('should throw error when email is duplicated', async () => {
|
|
288
|
+
// ...
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
````
|
|
362
293
|
|
|
363
|
-
|
|
294
|
+
Naming pattern:
|
|
295
|
+
A) ⭐ "should [expected behavior] when [condition]"
|
|
296
|
+
B) "it [expected behavior]"
|
|
297
|
+
C) Free-form
|
|
364
298
|
|
|
365
|
-
|
|
299
|
+
````
|
|
366
300
|
|
|
367
|
-
|
|
368
|
-
- Screen render time
|
|
369
|
-
- Memory usage
|
|
370
|
-
- Best for: Most apps
|
|
301
|
+
**6.6.1 Contract Testing** [If selected in 6.2]
|
|
371
302
|
|
|
372
|
-
|
|
303
|
+
```
|
|
304
|
+
[Production-Ready/Enterprise only]
|
|
305
|
+
|
|
306
|
+
Contract testing tool:
|
|
307
|
+
A) ⭐ Pact - Consumer-driven contracts
|
|
308
|
+
B) Spring Cloud Contract - Provider contracts
|
|
309
|
+
C) Other: __
|
|
310
|
+
|
|
311
|
+
Contract strategy:
|
|
312
|
+
A) ⭐ Consumer-driven - Frontend/consumers define contracts
|
|
313
|
+
B) Provider-driven - Backend defines contracts
|
|
314
|
+
C) Both - Hybrid approach
|
|
315
|
+
|
|
316
|
+
Contract storage:
|
|
317
|
+
A) ⭐ Pact Broker - Centralized contract storage
|
|
318
|
+
B) Git repository - Version contracts in code
|
|
319
|
+
C) Other: __
|
|
320
|
+
|
|
321
|
+
Contract versioning:
|
|
322
|
+
- Strategy: __
|
|
323
|
+
- Breaking changes: __
|
|
324
|
+
```
|
|
373
325
|
|
|
374
|
-
|
|
375
|
-
- Network performance
|
|
376
|
-
- Battery usage
|
|
377
|
-
- Best for: Performance-critical apps
|
|
326
|
+
**6.6.2 Load/Performance Testing** [If selected in 6.2]
|
|
378
327
|
|
|
379
|
-
|
|
328
|
+
```
|
|
329
|
+
[Production-Ready/Enterprise only]
|
|
330
|
+
|
|
331
|
+
Load testing tool:
|
|
332
|
+
A) ⭐ Artillery - Node.js, YAML-based
|
|
333
|
+
B) K6 - Modern, JavaScript-based
|
|
334
|
+
C) JMeter - Java-based, GUI available
|
|
335
|
+
D) Locust - Python-based
|
|
336
|
+
E) Other: __
|
|
337
|
+
|
|
338
|
+
Test scenarios:
|
|
339
|
+
- Normal load: __ requests/second
|
|
340
|
+
- Peak load: __ requests/second
|
|
341
|
+
- Stress test: __ requests/second (beyond capacity)
|
|
342
|
+
- Duration: __ minutes
|
|
343
|
+
|
|
344
|
+
Performance thresholds:
|
|
345
|
+
- Response time p50: < __ ms
|
|
346
|
+
- Response time p95: < __ ms
|
|
347
|
+
- Response time p99: < __ ms
|
|
348
|
+
- Error rate: < __%
|
|
349
|
+
- Throughput: > __ requests/second
|
|
350
|
+
|
|
351
|
+
When to run:
|
|
352
|
+
A) ⭐ Before major releases
|
|
353
|
+
B) Weekly automated runs
|
|
354
|
+
C) On-demand only
|
|
355
|
+
```
|
|
380
356
|
|
|
381
|
-
-
|
|
382
|
-
- Best for: MVPs
|
|
357
|
+
**6.6.3 Chaos Engineering** [If selected in 6.2 - Enterprise only]
|
|
383
358
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
359
|
+
```
|
|
360
|
+
[Enterprise only]
|
|
361
|
+
|
|
362
|
+
Chaos engineering tool:
|
|
363
|
+
A) ⭐ Chaos Monkey (Netflix)
|
|
364
|
+
B) Litmus (Kubernetes)
|
|
365
|
+
C) Gremlin - Managed chaos platform
|
|
366
|
+
D) Custom scripts
|
|
367
|
+
E) Other: __
|
|
368
|
+
|
|
369
|
+
Chaos experiments to run:
|
|
370
|
+
A) Network latency injection
|
|
371
|
+
B) Service failures
|
|
372
|
+
C) Database connection failures
|
|
373
|
+
D) CPU/memory exhaustion
|
|
374
|
+
E) Disk space issues
|
|
375
|
+
F) Network partition
|
|
376
|
+
|
|
377
|
+
→ Your selection (e.g., A, B, C): __
|
|
378
|
+
|
|
379
|
+
Safety rules:
|
|
380
|
+
- Run only in: [Staging, Production with approval]
|
|
381
|
+
- Blast radius: __% of traffic/instances
|
|
382
|
+
- Auto-rollback: [Yes/No]
|
|
383
|
+
- Approval required: [Yes/No]
|
|
384
|
+
```
|
|
387
385
|
|
|
388
|
-
**
|
|
386
|
+
**6.7 CI/CD Testing** [All scopes - simplified for MVP]
|
|
389
387
|
|
|
390
|
-
|
|
388
|
+
```
|
|
389
|
+
[If MVP scope:]
|
|
390
|
+
For MVP, we'll set up basic CI to run smoke tests.
|
|
391
391
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
- Best for: Most apps
|
|
392
|
+
When will smoke tests run?
|
|
393
|
+
A) ⭐ On pull request (GitHub Actions, GitLab CI) - Recommended
|
|
394
|
+
B) Before deploy only
|
|
396
395
|
|
|
397
|
-
|
|
396
|
+
Selected: __
|
|
398
397
|
|
|
399
|
-
|
|
400
|
-
-
|
|
401
|
-
-
|
|
398
|
+
Quality gate for MVP:
|
|
399
|
+
- ✅ All smoke tests must pass
|
|
400
|
+
- ⚠️ Coverage tracking (no minimum required)
|
|
402
401
|
|
|
403
|
-
|
|
402
|
+
[If Production-Ready or Enterprise scope:]
|
|
404
403
|
|
|
405
|
-
|
|
406
|
-
- Best for: Internal apps
|
|
404
|
+
When will tests run?
|
|
407
405
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
406
|
+
A) ⭐ On every commit (pre-commit hook) - Catch issues early
|
|
407
|
+
B) 🔥 On pull request (GitHub Actions, GitLab CI) - Most popular, prevents broken merges
|
|
408
|
+
C) ⭐ Before deploy (staging pipeline) - Recommended safety check
|
|
409
|
+
D) Nightly (comprehensive test suite) - For slow/extensive tests
|
|
411
410
|
|
|
412
|
-
|
|
411
|
+
Selected: __
|
|
413
412
|
|
|
414
|
-
|
|
413
|
+
Quality gates:
|
|
415
414
|
|
|
416
|
-
-
|
|
417
|
-
-
|
|
418
|
-
-
|
|
419
|
-
-
|
|
415
|
+
- ✅ All tests must pass
|
|
416
|
+
- ✅ Coverage must be >= __% (15-25% MVP, 60-80% Production, 80-95% Enterprise)
|
|
417
|
+
- ✅ No linting errors
|
|
418
|
+
- ⚡ Performance benchmarks met (optional, Enterprise recommended)
|
|
420
419
|
|
|
421
|
-
|
|
420
|
+
Failing a quality gate:
|
|
421
|
+
A) ⭐ Block merge/deploy - Force fix
|
|
422
|
+
B) ⚠️ Warning only - Allow with justification
|
|
422
423
|
|
|
423
|
-
|
|
424
|
-
- E2E on main branch
|
|
425
|
-
- Best for: Large teams
|
|
424
|
+
```
|
|
426
425
|
|
|
427
|
-
|
|
426
|
+
### Phase 6 Output
|
|
428
427
|
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
```
|
|
429
|
+
📋 PHASE 6 SUMMARY:
|
|
430
|
+
|
|
431
|
+
**If MVP scope (A):**
|
|
432
|
+
Testing Framework: [Jest/pytest/JUnit] (6.1)
|
|
433
|
+
Test Types: Smoke tests on critical paths [selected 3-5 critical flows] (6.2)
|
|
434
|
+
Test Approach: Integration/E2E tests covering happy path only (6.2)
|
|
435
|
+
Coverage Target: 15-25% (6.2)
|
|
436
|
+
CI/CD Testing: [on PR/before deploy] + quality gate: all tests must pass (6.7)
|
|
437
|
+
Status: Basic testing implemented for MVP
|
|
438
|
+
|
|
439
|
+
**If Production-Ready (B):**
|
|
440
|
+
Testing Framework: [Jest/pytest/JUnit + assertion library + mocking library] (6.1)
|
|
441
|
+
Test Types: [unit/integration/e2e - selected types] (6.2)
|
|
442
|
+
Test Distribution: [pyramid percentages: 70/20/10 or custom] (6.2)
|
|
443
|
+
Test Database: [in-memory/Docker/shared/mock + initial data strategy] (6.3)
|
|
444
|
+
Test Data Management: [factories/fixtures/faker approach + specific test data needs] (6.4)
|
|
445
|
+
Mocking Strategy: [what to mock (APIs/DB/files/time/email/payments) + approach] (6.5)
|
|
446
|
+
Test Organization: [co-located/separate folder + naming pattern] (6.6)
|
|
447
|
+
CI/CD Testing: [when tests run (commit/PR/deploy/nightly) + quality gates (pass/60-80% coverage/lint) + gate behavior (block/warn)] (6.7)
|
|
448
|
+
Status: Comprehensive testing strategy implemented
|
|
449
|
+
|
|
450
|
+
**If Enterprise (C):**
|
|
451
|
+
Testing Framework: [Jest/pytest/JUnit + assertion library + mocking library] (6.1)
|
|
452
|
+
Test Types: [unit/integration/e2e/contract/load/chaos - all types] (6.2)
|
|
453
|
+
Test Distribution: [pyramid percentages: 70/20/10 or custom] (6.2)
|
|
454
|
+
Test Database: [in-memory/Docker/shared/mock + initial data strategy] (6.3)
|
|
455
|
+
Test Data Management: [factories/fixtures/faker approach + specific test data needs] (6.4)
|
|
456
|
+
Mocking Strategy: [what to mock (APIs/DB/files/time/email/payments) + approach] (6.5)
|
|
457
|
+
Test Organization: [co-located/separate folder + naming pattern] (6.6)
|
|
458
|
+
Contract Testing: [tool (Pact/Spring Cloud Contract) + strategy + storage + versioning] (6.6.1)
|
|
459
|
+
Load Testing: [tool (Artillery/K6/JMeter) + scenarios + thresholds + schedule] (6.6.2)
|
|
460
|
+
Chaos Engineering: [tool (Chaos Monkey/Litmus/Gremlin) + experiments + safety rules] (6.6.3)
|
|
461
|
+
CI/CD Testing: [when tests run (commit/PR/deploy/nightly) + quality gates (pass/80-95% coverage/lint/performance) + gate behavior (block/warn)] (6.7)
|
|
462
|
+
Status: Exhaustive testing strategy with advanced scenarios
|
|
463
|
+
|
|
464
|
+
Is this correct? (Yes/No)
|
|
465
|
+
```
|
|
466
|
+
---
|
|
467
|
+
### 📄 Generate Phase 6 Documents
|
|
431
468
|
|
|
432
|
-
**
|
|
433
|
-
---
|
|
434
|
-
### Question 6.12: Test Data Management
|
|
469
|
+
**Before starting generation:**
|
|
435
470
|
|
|
436
|
-
|
|
471
|
+
```
|
|
472
|
+
📖 Loading context from previous phases...
|
|
473
|
+
✅ Re-reading docs/code-standards.md
|
|
474
|
+
✅ Re-reading ai-instructions.md
|
|
475
|
+
```
|
|
437
476
|
|
|
438
|
-
|
|
477
|
+
**Generate `docs/testing.md` automatically:**
|
|
439
478
|
|
|
440
|
-
-
|
|
441
|
-
-
|
|
442
|
-
-
|
|
479
|
+
- Use template: `.ai-flow/templates/docs/testing.template.md`
|
|
480
|
+
- **If MVP scope:** Fill with basic testing strategy: framework selection, smoke tests on critical paths, coverage 15-25%, basic CI setup. Mark advanced sections as "Not implemented yet - expand when moving to Production-Ready"
|
|
481
|
+
- **If Production-Ready:** Fill with comprehensive testing strategy: framework, unit/integration/e2e tests, 60-80% coverage, test data management, mocking, full CI/CD
|
|
482
|
+
- **If Enterprise:** Fill with exhaustive testing strategy: all Production-Ready items + contract tests, load tests, security tests, 80-95% coverage, performance benchmarks
|
|
483
|
+
- Write to: `docs/testing.md`
|
|
443
484
|
|
|
444
|
-
|
|
485
|
+
```
|
|
486
|
+
✅ Generated: docs/testing.md
|
|
445
487
|
|
|
446
|
-
|
|
447
|
-
- Best for: Integration testing
|
|
488
|
+
Document has been created with all Phase 6 information.
|
|
448
489
|
|
|
449
|
-
|
|
490
|
+
📝 Would you like to make any corrections before continuing?
|
|
450
491
|
|
|
451
|
-
|
|
452
|
-
|
|
492
|
+
→ If yes: Edit the file and type "ready" when done. I'll re-read it.
|
|
493
|
+
→ If no: Type "continue" to proceed to Phase 7.
|
|
494
|
+
```
|
|
453
495
|
|
|
454
|
-
**
|
|
455
|
-
|
|
456
|
-
|
|
496
|
+
**If user edits file:**
|
|
497
|
+
Re-read file to refresh context before continuing.
|
|
498
|
+
---
|
|
499
|
+
**Proceed to Phase 7 only after documents are validated.**
|
|
457
500
|
|
|
458
|
-
|
|
501
|
+
> ⚠️ **CRITICAL:** DO NOT generate README.md in this phase. README.md is ONLY generated in Phase 8 (step 8.5) after framework initialization.
|
|
502
|
+
---
|
|
459
503
|
|
|
460
|
-
```
|
|
461
|
-
---
|
|
462
|
-
✅ Phase 6 Complete: Testing Strategy
|
|
463
|
-
---
|
|
464
|
-
Selected Testing Stack:
|
|
465
|
-
- Unit Tests: Jest (React Native Testing Library)
|
|
466
|
-
- E2E Tests: Detox
|
|
467
|
-
- Device Testing: TestFlight + Firebase App Distribution
|
|
468
|
-
- Coverage Target: 80% overall
|
|
469
|
-
- Snapshot Testing: Yes (Jest Snapshots)
|
|
470
|
-
- Performance Testing: Basic
|
|
471
|
-
- Accessibility Testing: Basic
|
|
472
|
-
- CI/CD: Run all tests on PR
|
|
473
|
-
|
|
474
|
-
Proceed to Phase 7 (Store Deployment)? (Y/n)
|
|
475
|
-
```
|
|
476
|
-
---
|
|
477
504
|
## 📝 Generated Documents
|
|
478
505
|
|
|
479
506
|
After Phase 6, generate/update:
|
|
507
|
+
- `docs/testing.md` - Testing strategy and quality gates
|
|
508
|
+
|
|
509
|
+
---
|
|
480
510
|
|
|
481
|
-
|
|
482
|
-
- `ai-instructions.md` - Add testing rules
|
|
483
|
-
---
|
|
484
|
-
**Next Phase:** Phase 7 - Store Deployment
|
|
511
|
+
**Next Phase:** Phase 7 - Operations & Deployment (10-15 min)
|
|
485
512
|
|
|
486
|
-
Read: `.ai-flow/prompts/
|
|
487
|
-
---
|
|
488
|
-
**Last Updated:** 2025-01-XX
|
|
513
|
+
Read: `.ai-flow/prompts/backend/flow-build-phase-7.md`
|
|
489
514
|
|
|
490
|
-
|
|
515
|
+
---
|
|
491
516
|
|
|
517
|
+
**Last Updated:** 2025-12-20
|
|
518
|
+
**Version:** 2.1.8
|
|
492
519
|
|
|
520
|
+
---
|
|
493
521
|
|
|
522
|
+
## PHASE 7: Operations & Deployment (10-15 min)
|
|
494
523
|
|
|
524
|
+
````
|