@sk8metal/michi-cli 0.10.1 → 0.11.0
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 +77 -847
- package/dist/scripts/phase-runner.js +1 -1
- package/dist/scripts/phase-runner.js.map +1 -1
- package/dist/scripts/utils/multi-repo-validator.d.ts +18 -0
- package/dist/scripts/utils/multi-repo-validator.d.ts.map +1 -1
- package/dist/scripts/utils/multi-repo-validator.js +42 -0
- package/dist/scripts/utils/multi-repo-validator.js.map +1 -1
- package/dist/scripts/utils/tasks-format-validator.js +3 -3
- package/dist/scripts/utils/tasks-format-validator.js.map +1 -1
- package/docs/README.md +20 -83
- package/docs/getting-started/configuration.md +379 -0
- package/docs/getting-started/installation.md +59 -0
- package/docs/getting-started/quick-start.md +76 -0
- package/docs/guides/ai-tools.md +311 -0
- package/docs/guides/atlassian-integration.md +116 -0
- package/docs/guides/claude-code.md +155 -0
- package/docs/guides/multi-repo.md +117 -0
- package/docs/guides/workflow.md +382 -0
- package/docs/reference/ai-commands.md +92 -0
- package/docs/reference/cli.md +756 -0
- package/docs/reference/environment-variables.md +192 -0
- package/docs/troubleshooting.md +543 -0
- package/package.json +1 -1
- package/scripts/phase-runner.ts +1 -1
- package/scripts/utils/__tests__/multi-repo-validator.test.ts +159 -1
- package/scripts/utils/multi-repo-validator.ts +50 -0
- package/scripts/utils/tasks-format-validator.ts +3 -3
- package/templates/claude/agents/e2e-first-planner/AGENT.md +1 -1
- package/templates/claude/agents/pr-resolver/AGENT.md +15 -3
- package/templates/claude/commands/michi/e2e-plan.md +1 -1
- package/templates/claude/commands/michi/spec-design.md +2 -2
- package/templates/claude/commands/michi/spec-tasks.md +156 -0
- package/templates/claude/commands/michi/test-planning.md +1 -1
- package/templates/claude/commands/michi/validate-design.md +3 -3
- package/templates/claude/commands/michi-multi-repo/impl-all.md +30 -1
- package/templates/claude/commands/michi-multi-repo/propagate-specs.md +14 -1
- package/templates/claude/commands/michi-multi-repo/spec-review.md +16 -2
- package/templates/claude-agent/agents/repo-spec-executor.md +1 -1
- package/templates/claude-agent/commands/michi/spec-tasks.md +117 -0
- package/templates/claude-agent/rules/code-size-monitor.md +26 -0
- package/templates/claude-agent/rules/code-size-rules.md +32 -0
- package/templates/codex/AGENTS.override.md +1 -1
- package/templates/codex/rules/README.md +2 -2
- package/templates/cursor/commands/michi/spec-tasks.md +117 -0
- package/templates/michi/cc-sdd-overrides/settings/rules/design-review-michi.md +1 -1
- package/docs/context.md +0 -59
- package/docs/michi-development/contributing/development.md +0 -341
- package/docs/michi-development/contributing/release.md +0 -365
- package/docs/michi-development/design/config-unification.md +0 -733
- package/docs/michi-development/design/design-config-current-state.md +0 -330
- package/docs/michi-development/design/design-config-implementation.md +0 -628
- package/docs/michi-development/design/design-config-migration.md +0 -952
- package/docs/michi-development/design/design-config-security.md +0 -771
- package/docs/michi-development/design/design-config-solution.md +0 -583
- package/docs/michi-development/design/design-config-testing.md +0 -892
- package/docs/michi-development/testing/manual-verification-flow.md +0 -871
- package/docs/michi-development/testing/manual-verification-other-tools.md +0 -1279
- package/docs/michi-development/testing/manual-verification-troubleshooting.md +0 -122
- package/docs/michi-development/testing/pre-publish-checklist.md +0 -560
- package/docs/michi-development/testing-strategy.md +0 -87
- package/docs/plan.md +0 -275
- package/docs/user-guide/getting-started/github-token-setup.md +0 -510
- package/docs/user-guide/getting-started/new-repository-setup.md +0 -704
- package/docs/user-guide/getting-started/quick-start.md +0 -212
- package/docs/user-guide/getting-started/setup.md +0 -819
- package/docs/user-guide/guides/agent-skills-integration.md +0 -222
- package/docs/user-guide/guides/customization.md +0 -537
- package/docs/user-guide/guides/internationalization.md +0 -540
- package/docs/user-guide/guides/migration-guide.md +0 -138
- package/docs/user-guide/guides/multi-project.md +0 -368
- package/docs/user-guide/guides/multi-repo-guide.md +0 -1590
- package/docs/user-guide/guides/phase-automation.md +0 -419
- package/docs/user-guide/guides/workflow.md +0 -574
- package/docs/user-guide/hands-on/README.md +0 -142
- package/docs/user-guide/hands-on/claude-agent-setup.md +0 -597
- package/docs/user-guide/hands-on/claude-setup.md +0 -452
- package/docs/user-guide/hands-on/cursor-setup.md +0 -353
- package/docs/user-guide/hands-on/troubleshooting.md +0 -964
- package/docs/user-guide/hands-on/verification-checklist.md +0 -439
- package/docs/user-guide/hands-on/workflow-walkthrough.md +0 -1078
- package/docs/user-guide/reference/config.md +0 -589
- package/docs/user-guide/reference/multi-repo-api.md +0 -771
- package/docs/user-guide/reference/quick-reference.md +0 -297
- package/docs/user-guide/reference/security-test-payloads.md +0 -50
- package/docs/user-guide/reference/tasks-template.md +0 -550
- package/docs/user-guide/release/ci-setup-java.md +0 -114
- package/docs/user-guide/release/ci-setup-nodejs.md +0 -94
- package/docs/user-guide/release/ci-setup-php.md +0 -102
- package/docs/user-guide/release/ci-setup-troubleshooting.md +0 -94
- package/docs/user-guide/release/ci-setup.md +0 -188
- package/docs/user-guide/release/release-flow.md +0 -476
- package/docs/user-guide/templates/test-specs/README.md +0 -173
- package/docs/user-guide/templates/test-specs/e2e-test-spec-template.md +0 -553
- package/docs/user-guide/templates/test-specs/integration-test-spec-template.md +0 -435
- package/docs/user-guide/templates/test-specs/performance-test-spec-template.md +0 -454
- package/docs/user-guide/templates/test-specs/security-test-spec-template.md +0 -625
- package/docs/user-guide/templates/test-specs/unit-test-spec-template.md +0 -328
- package/docs/user-guide/testing/integration-tests.md +0 -312
- package/docs/user-guide/testing/tdd-cycle.md +0 -349
- package/docs/user-guide/testing/test-execution-flow.md +0 -396
- package/docs/user-guide/testing/test-failure-handling.md +0 -521
- package/docs/user-guide/testing/test-planning-flow.md +0 -185
- package/docs/user-guide/testing-strategy.md +0 -185
- package/docs/verification-guide.md +0 -518
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
# Performance Test Specification: {{TEST_NAME}}
|
|
2
|
-
|
|
3
|
-
**Author**: {{AUTHOR}}
|
|
4
|
-
**Date**: {{DATE}}
|
|
5
|
-
**Version**: 1.0
|
|
6
|
-
|
|
7
|
-
## 1. Overview
|
|
8
|
-
|
|
9
|
-
### 1.1 Purpose
|
|
10
|
-
{{PURPOSE}}
|
|
11
|
-
|
|
12
|
-
Example: To verify the performance requirements of the {{SYSTEM_NAME}} system and confirm system behavior under high load conditions.
|
|
13
|
-
|
|
14
|
-
### 1.2 Scope
|
|
15
|
-
{{SCOPE}}
|
|
16
|
-
|
|
17
|
-
Example: This test specification covers response time, throughput, and resource utilization for the user management feature.
|
|
18
|
-
|
|
19
|
-
### 1.3 Testing Tool
|
|
20
|
-
- **Tool**: {{TOOL_NAME}}
|
|
21
|
-
- **Version**: {{VERSION}}
|
|
22
|
-
|
|
23
|
-
Example:
|
|
24
|
-
- **Tool**: Apache JMeter / k6 / Artillery / Locust
|
|
25
|
-
- **Version**: 5.6.2 / 0.47.0 / 2.0.0 / 2.15.0
|
|
26
|
-
|
|
27
|
-
## 2. Test Environment
|
|
28
|
-
|
|
29
|
-
### 2.1 Software Requirements
|
|
30
|
-
- Programming Language: {{LANGUAGE}} {{VERSION}}
|
|
31
|
-
- Application Server: {{SERVER}} {{VERSION}}
|
|
32
|
-
- Database: {{DATABASE}} {{VERSION}}
|
|
33
|
-
- Load Balancer: {{LOAD_BALANCER}} (if applicable)
|
|
34
|
-
|
|
35
|
-
### 2.2 Hardware Requirements
|
|
36
|
-
- Test Client: {{CLIENT_SPEC}}
|
|
37
|
-
- Application Server: {{APP_SERVER_SPEC}}
|
|
38
|
-
- Database Server: {{DB_SERVER_SPEC}}
|
|
39
|
-
- Network: {{NETWORK_SPEC}}
|
|
40
|
-
|
|
41
|
-
Example:
|
|
42
|
-
- Test Client: 4 vCPU, 8GB RAM
|
|
43
|
-
- Application Server: 8 vCPU, 16GB RAM
|
|
44
|
-
- Database Server: 16 vCPU, 32GB RAM
|
|
45
|
-
- Network: 10Gbps LAN
|
|
46
|
-
|
|
47
|
-
### 2.3 Test Data
|
|
48
|
-
- Data Volume: {{DATA_VOLUME}}
|
|
49
|
-
- Data Preparation Script: `{{DATA_SCRIPT}}`
|
|
50
|
-
- Data Cleanup Script: `{{CLEANUP_SCRIPT}}`
|
|
51
|
-
|
|
52
|
-
## 3. Performance Requirements
|
|
53
|
-
|
|
54
|
-
### 3.1 Response Time Requirements
|
|
55
|
-
|
|
56
|
-
| Endpoint/Function | Expected Response Time (Average) | Maximum Acceptable Response Time (95th Percentile) |
|
|
57
|
-
|-------------------|----------------------------------|---------------------------------------------------|
|
|
58
|
-
| {{ENDPOINT_1}} | {{AVG_TIME}} ms | {{MAX_TIME}} ms |
|
|
59
|
-
| {{ENDPOINT_2}} | {{AVG_TIME}} ms | {{MAX_TIME}} ms |
|
|
60
|
-
|
|
61
|
-
Example:
|
|
62
|
-
|
|
63
|
-
| Endpoint/Function | Expected Response Time (Average) | Maximum Acceptable Response Time (95th Percentile) |
|
|
64
|
-
|-------------------|----------------------------------|---------------------------------------------------|
|
|
65
|
-
| GET /api/users | 200 ms | 500 ms |
|
|
66
|
-
| POST /api/users | 300 ms | 800 ms |
|
|
67
|
-
| GET /api/users/{id} | 100 ms | 300 ms |
|
|
68
|
-
|
|
69
|
-
### 3.2 Throughput Requirements
|
|
70
|
-
|
|
71
|
-
| Scenario | Expected Throughput | Minimum Acceptable Throughput |
|
|
72
|
-
|----------|---------------------|------------------------------|
|
|
73
|
-
| {{SCENARIO_1}} | {{TARGET_TPS}} req/sec | {{MIN_TPS}} req/sec |
|
|
74
|
-
| {{SCENARIO_2}} | {{TARGET_TPS}} req/sec | {{MIN_TPS}} req/sec |
|
|
75
|
-
|
|
76
|
-
Example:
|
|
77
|
-
|
|
78
|
-
| Scenario | Expected Throughput | Minimum Acceptable Throughput |
|
|
79
|
-
|----------|---------------------|------------------------------|
|
|
80
|
-
| User Registration | 100 req/sec | 80 req/sec |
|
|
81
|
-
| User Search | 500 req/sec | 400 req/sec |
|
|
82
|
-
|
|
83
|
-
### 3.3 Resource Utilization Requirements
|
|
84
|
-
|
|
85
|
-
| Resource | Maximum Acceptable Usage |
|
|
86
|
-
|----------|-------------------------|
|
|
87
|
-
| CPU | {{CPU_LIMIT}}% |
|
|
88
|
-
| Memory | {{MEMORY_LIMIT}}% |
|
|
89
|
-
| Disk I/O | {{DISK_LIMIT}} IOPS |
|
|
90
|
-
| Network | {{NETWORK_LIMIT}} Mbps |
|
|
91
|
-
|
|
92
|
-
Example:
|
|
93
|
-
|
|
94
|
-
| Resource | Maximum Acceptable Usage |
|
|
95
|
-
|----------|-------------------------|
|
|
96
|
-
| CPU | 70% |
|
|
97
|
-
| Memory | 80% |
|
|
98
|
-
| Disk I/O | 5000 IOPS |
|
|
99
|
-
| Network | 800 Mbps |
|
|
100
|
-
|
|
101
|
-
## 4. Test Scenarios
|
|
102
|
-
|
|
103
|
-
### Test Scenario PT-001: {{SCENARIO_NAME}}
|
|
104
|
-
|
|
105
|
-
**Description**: {{SCENARIO_DESCRIPTION}}
|
|
106
|
-
|
|
107
|
-
Example: Verify performance of user registration API under normal load conditions.
|
|
108
|
-
|
|
109
|
-
**Load Pattern**:
|
|
110
|
-
- Concurrent Users: {{CONCURRENT_USERS}}
|
|
111
|
-
- Ramp-up Time: {{RAMP_UP}} seconds
|
|
112
|
-
- Test Duration: {{DURATION}} minutes
|
|
113
|
-
|
|
114
|
-
Example:
|
|
115
|
-
- Concurrent Users: 100
|
|
116
|
-
- Ramp-up Time: 60 seconds
|
|
117
|
-
- Test Duration: 10 minutes
|
|
118
|
-
|
|
119
|
-
**Test Steps**:
|
|
120
|
-
1. {{STEP_1}}
|
|
121
|
-
2. {{STEP_2}}
|
|
122
|
-
3. {{STEP_3}}
|
|
123
|
-
|
|
124
|
-
Example:
|
|
125
|
-
1. Gradually increase to 100 users over 60 seconds
|
|
126
|
-
2. Send POST requests to /api/users (each user)
|
|
127
|
-
3. Continue for 10 minutes
|
|
128
|
-
4. Measure response time and throughput
|
|
129
|
-
|
|
130
|
-
**Expected Results**:
|
|
131
|
-
{{EXPECTED_RESULTS}}
|
|
132
|
-
|
|
133
|
-
Example:
|
|
134
|
-
- Average response time: ≤ 300ms
|
|
135
|
-
- 95th percentile: ≤ 800ms
|
|
136
|
-
- Throughput: ≥ 100 req/sec
|
|
137
|
-
- Error rate: ≤ 1%
|
|
138
|
-
|
|
139
|
-
**Actual Results**:
|
|
140
|
-
[To be filled during test execution]
|
|
141
|
-
|
|
142
|
-
**Status**: [ ] Pass / [ ] Fail / [ ] Blocked
|
|
143
|
-
|
|
144
|
-
**Notes**:
|
|
145
|
-
{{NOTES}}
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
### Test Scenario PT-002: Stress Test - {{SCENARIO_NAME}}
|
|
150
|
-
|
|
151
|
-
**Description**: {{SCENARIO_DESCRIPTION}}
|
|
152
|
-
|
|
153
|
-
Example: Gradually increase load to identify system limits.
|
|
154
|
-
|
|
155
|
-
**Load Pattern**:
|
|
156
|
-
- Starting Concurrent Users: {{START_USERS}}
|
|
157
|
-
- Final Concurrent Users: {{END_USERS}}
|
|
158
|
-
- Increment Rate: {{INCREMENT}} users/minute
|
|
159
|
-
- Test Duration: {{DURATION}} minutes
|
|
160
|
-
|
|
161
|
-
Example:
|
|
162
|
-
- Starting Concurrent Users: 50
|
|
163
|
-
- Final Concurrent Users: 500
|
|
164
|
-
- Increment Rate: 50 users/minute
|
|
165
|
-
- Test Duration: 15 minutes
|
|
166
|
-
|
|
167
|
-
**Expected Results**:
|
|
168
|
-
{{EXPECTED_RESULTS}}
|
|
169
|
-
|
|
170
|
-
Example:
|
|
171
|
-
- Identify the threshold at which system breaks down
|
|
172
|
-
- Threshold: Above 400 concurrent users
|
|
173
|
-
- Symptoms at breakdown: Response time >5 seconds, Error rate >10%
|
|
174
|
-
|
|
175
|
-
**Actual Results**:
|
|
176
|
-
[To be filled during test execution]
|
|
177
|
-
|
|
178
|
-
**Status**: [ ] Pass / [ ] Fail / [ ] Blocked
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
### Test Scenario PT-003: Endurance Test (Soak Test) - {{SCENARIO_NAME}}
|
|
183
|
-
|
|
184
|
-
**Description**: {{SCENARIO_DESCRIPTION}}
|
|
185
|
-
|
|
186
|
-
Example: Verify no memory leaks or performance degradation during extended continuous operation.
|
|
187
|
-
|
|
188
|
-
**Load Pattern**:
|
|
189
|
-
- Concurrent Users: {{CONCURRENT_USERS}} (constant)
|
|
190
|
-
- Test Duration: {{DURATION}} hours
|
|
191
|
-
|
|
192
|
-
Example:
|
|
193
|
-
- Concurrent Users: 100 (constant)
|
|
194
|
-
- Test Duration: 4 hours
|
|
195
|
-
|
|
196
|
-
**Expected Results**:
|
|
197
|
-
{{EXPECTED_RESULTS}}
|
|
198
|
-
|
|
199
|
-
Example:
|
|
200
|
-
- Response time does not degrade more than 20% from initial value after 4 hours
|
|
201
|
-
- Memory usage does not exceed 80%
|
|
202
|
-
- Error rate does not exceed 1%
|
|
203
|
-
|
|
204
|
-
**Actual Results**:
|
|
205
|
-
[To be filled during test execution]
|
|
206
|
-
|
|
207
|
-
**Status**: [ ] Pass / [ ] Fail / [ ] Blocked
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
### Test Scenario PT-004: Spike Test - {{SCENARIO_NAME}}
|
|
212
|
-
|
|
213
|
-
**Description**: {{SCENARIO_DESCRIPTION}}
|
|
214
|
-
|
|
215
|
-
Example: Verify system behavior during sudden traffic spikes.
|
|
216
|
-
|
|
217
|
-
**Load Pattern**:
|
|
218
|
-
- Normal Load: {{NORMAL_LOAD}} users
|
|
219
|
-
- Spike Load: {{SPIKE_LOAD}} users
|
|
220
|
-
- Spike Duration: {{SPIKE_DURATION}} seconds
|
|
221
|
-
|
|
222
|
-
Example:
|
|
223
|
-
- Normal Load: 50 users
|
|
224
|
-
- Spike Load: 500 users (10x increase)
|
|
225
|
-
- Spike Duration: 60 seconds
|
|
226
|
-
|
|
227
|
-
**Expected Results**:
|
|
228
|
-
{{EXPECTED_RESULTS}}
|
|
229
|
-
|
|
230
|
-
Example:
|
|
231
|
-
- Error rate ≤ 5% during spike
|
|
232
|
-
- System recovers to normal response time after spike ends
|
|
233
|
-
|
|
234
|
-
**Actual Results**:
|
|
235
|
-
[To be filled during test execution]
|
|
236
|
-
|
|
237
|
-
**Status**: [ ] Pass / [ ] Fail / [ ] Blocked
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## 5. Test Execution Summary
|
|
242
|
-
|
|
243
|
-
| ID | Test Name | Status | Executed By | Date | Notes |
|
|
244
|
-
|----|-----------|--------|-------------|------|-------|
|
|
245
|
-
| PT-001 | {{NAME}} | | | | |
|
|
246
|
-
| PT-002 | {{NAME}} | | | | |
|
|
247
|
-
| PT-003 | {{NAME}} | | | | |
|
|
248
|
-
| PT-004 | {{NAME}} | | | | |
|
|
249
|
-
|
|
250
|
-
## 6. Defects Found
|
|
251
|
-
|
|
252
|
-
| Defect ID | Severity | Description | Affected Components | Status |
|
|
253
|
-
|-----------|----------|-------------|---------------------|--------|
|
|
254
|
-
| | High/Medium/Low | | | Open/In Progress/Fixed/Closed |
|
|
255
|
-
|
|
256
|
-
## 7. Sign-off
|
|
257
|
-
|
|
258
|
-
**Tested By**: _______________
|
|
259
|
-
**Date**: _______________
|
|
260
|
-
**Approved By**: _______________
|
|
261
|
-
**Date**: _______________
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
## Appendix A: Test Environment Setup
|
|
266
|
-
|
|
267
|
-
### Load Testing Tool Installation
|
|
268
|
-
|
|
269
|
-
#### Apache JMeter
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
# Download and start JMeter
|
|
273
|
-
wget https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.6.2.tgz
|
|
274
|
-
tar -xzf apache-jmeter-5.6.2.tgz
|
|
275
|
-
cd apache-jmeter-5.6.2/bin
|
|
276
|
-
./jmeter
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
#### k6
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
# macOS
|
|
283
|
-
brew install k6
|
|
284
|
-
|
|
285
|
-
# Linux
|
|
286
|
-
sudo gpg -k
|
|
287
|
-
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
|
|
288
|
-
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
|
|
289
|
-
sudo apt-get update
|
|
290
|
-
sudo apt-get install k6
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
#### Artillery
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
npm install -g artillery
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
#### Locust
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
# Requires Python environment (Python 3.7+)
|
|
303
|
-
pip install locust
|
|
304
|
-
|
|
305
|
-
# Or in virtual environment
|
|
306
|
-
python3 -m venv venv
|
|
307
|
-
source venv/bin/activate
|
|
308
|
-
pip install locust
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Appendix B: Sample Test Scripts
|
|
312
|
-
|
|
313
|
-
### k6 Script Example
|
|
314
|
-
|
|
315
|
-
```javascript
|
|
316
|
-
import http from 'k6/http';
|
|
317
|
-
import { check, sleep } from 'k6';
|
|
318
|
-
|
|
319
|
-
export let options = {
|
|
320
|
-
stages: [
|
|
321
|
-
{ duration: '1m', target: 100 }, // Ramp-up
|
|
322
|
-
{ duration: '10m', target: 100 }, // Sustained load
|
|
323
|
-
{ duration: '1m', target: 0 }, // Ramp-down
|
|
324
|
-
],
|
|
325
|
-
thresholds: {
|
|
326
|
-
http_req_duration: ['p(95)<800'], // 95% of requests under 800ms
|
|
327
|
-
http_req_failed: ['rate<0.01'], // Error rate under 1%
|
|
328
|
-
},
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export default function () {
|
|
332
|
-
const res = http.post('https://api.example.com/users', JSON.stringify({
|
|
333
|
-
name: 'Test User',
|
|
334
|
-
email: `test-${Date.now()}@example.com`,
|
|
335
|
-
}), {
|
|
336
|
-
headers: { 'Content-Type': 'application/json' },
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
check(res, {
|
|
340
|
-
'status is 201': (r) => r.status === 201,
|
|
341
|
-
'response time < 500ms': (r) => r.timings.duration < 500,
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
sleep(1);
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Apache JMeter Test Plan Example
|
|
349
|
-
|
|
350
|
-
```xml
|
|
351
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
352
|
-
<jmeterTestPlan version="1.2">
|
|
353
|
-
<hashTree>
|
|
354
|
-
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="User API Performance Test">
|
|
355
|
-
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments">
|
|
356
|
-
<collectionProp name="Arguments.arguments"/>
|
|
357
|
-
</elementProp>
|
|
358
|
-
</TestPlan>
|
|
359
|
-
<hashTree>
|
|
360
|
-
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users">
|
|
361
|
-
<stringProp name="ThreadGroup.num_threads">100</stringProp>
|
|
362
|
-
<stringProp name="ThreadGroup.ramp_time">60</stringProp>
|
|
363
|
-
<stringProp name="ThreadGroup.duration">600</stringProp>
|
|
364
|
-
</ThreadGroup>
|
|
365
|
-
<hashTree>
|
|
366
|
-
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST /api/users">
|
|
367
|
-
<stringProp name="HTTPSampler.domain">api.example.com</stringProp>
|
|
368
|
-
<stringProp name="HTTPSampler.path">/api/users</stringProp>
|
|
369
|
-
<stringProp name="HTTPSampler.method">POST</stringProp>
|
|
370
|
-
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
|
371
|
-
</HTTPSamplerProxy>
|
|
372
|
-
</hashTree>
|
|
373
|
-
</hashTree>
|
|
374
|
-
</hashTree>
|
|
375
|
-
</jmeterTestPlan>
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### Artillery Script Example
|
|
379
|
-
|
|
380
|
-
```yaml
|
|
381
|
-
config:
|
|
382
|
-
target: 'https://api.example.com'
|
|
383
|
-
phases:
|
|
384
|
-
- duration: 60
|
|
385
|
-
arrivalRate: 10
|
|
386
|
-
rampTo: 100
|
|
387
|
-
name: "Ramp up"
|
|
388
|
-
- duration: 600
|
|
389
|
-
arrivalRate: 100
|
|
390
|
-
name: "Sustained load"
|
|
391
|
-
processor: "./custom-functions.js"
|
|
392
|
-
|
|
393
|
-
scenarios:
|
|
394
|
-
- name: "User Registration"
|
|
395
|
-
flow:
|
|
396
|
-
- post:
|
|
397
|
-
url: "/api/users"
|
|
398
|
-
json:
|
|
399
|
-
name: "Test User"
|
|
400
|
-
email: "test@example.com"
|
|
401
|
-
expect:
|
|
402
|
-
- statusCode: 201
|
|
403
|
-
- contentType: json
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
### Locust Script Example
|
|
407
|
-
|
|
408
|
-
```python
|
|
409
|
-
from locust import HttpUser, task, between
|
|
410
|
-
|
|
411
|
-
class UserBehavior(HttpUser):
|
|
412
|
-
wait_time = between(1, 3) # Wait time between users (1-3 seconds)
|
|
413
|
-
|
|
414
|
-
@task(3) # Weight (in this case, runs 3x more frequently)
|
|
415
|
-
def create_user(self):
|
|
416
|
-
"""Test user registration API"""
|
|
417
|
-
self.client.post("/api/users", json={
|
|
418
|
-
"name": "Test User",
|
|
419
|
-
"email": f"test-{self.environment.runner.user_count}@example.com"
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
@task(1)
|
|
423
|
-
def get_user(self):
|
|
424
|
-
"""Test user retrieval API"""
|
|
425
|
-
self.client.get("/api/users/1")
|
|
426
|
-
|
|
427
|
-
def on_start(self):
|
|
428
|
-
"""Executed when each user starts (e.g., login)"""
|
|
429
|
-
pass
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
**Locust Execution Commands:**
|
|
433
|
-
|
|
434
|
-
```bash
|
|
435
|
-
# Start in web mode (GUI in browser)
|
|
436
|
-
locust -f locustfile.py --host=https://api.example.com
|
|
437
|
-
|
|
438
|
-
# Start in headless mode (CLI)
|
|
439
|
-
locust -f locustfile.py --host=https://api.example.com \
|
|
440
|
-
--users 100 --spawn-rate 10 --run-time 10m --headless
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
## Appendix C: Execution Timing
|
|
444
|
-
|
|
445
|
-
## Phase B (Before Release) - Manual Execution
|
|
446
|
-
|
|
447
|
-
Performance tests are executed manually before creating a release tag:
|
|
448
|
-
|
|
449
|
-
1. After PR is merged to main branch
|
|
450
|
-
2. Before creating a release tag
|
|
451
|
-
3. Run all performance tests in Phase B
|
|
452
|
-
4. Proceed to release only after all tests pass
|
|
453
|
-
|
|
454
|
-
Performance tests are **NOT** executed automatically in CI/CD during PR phase (Phase A) due to long execution times.
|