@skyramp/mcp 0.0.59 → 0.0.60-rc.2
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/build/index.js +32 -5
- package/build/prompts/test-recommendation/analysisOutputPrompt.js +98 -0
- package/build/prompts/test-recommendation/recommendationSections.js +226 -0
- package/build/prompts/test-recommendation/registerRecommendTestsPrompt.js +71 -0
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +166 -104
- package/build/prompts/testGenerationPrompt.js +2 -3
- package/build/prompts/testbot/testbot-prompts.js +96 -93
- package/build/resources/analysisResources.js +254 -0
- package/build/services/ScenarioGenerationService.js +70 -26
- package/build/tools/generate-tests/generateIntegrationRestTool.js +54 -1
- package/build/tools/generate-tests/generateScenarioRestTool.js +8 -5
- package/build/tools/submitReportTool.js +28 -0
- package/build/tools/test-maintenance/stateCleanupTool.js +8 -0
- package/build/tools/test-recommendation/analyzeRepositoryTool.js +349 -217
- package/build/tools/test-recommendation/recommendTestsTool.js +163 -159
- package/build/tools/workspace/initializeWorkspaceTool.js +1 -1
- package/build/types/RepositoryAnalysis.js +99 -12
- package/build/utils/AnalysisStateManager.js +40 -23
- package/build/utils/branchDiff.js +47 -0
- package/build/utils/pr-comment-parser.js +124 -0
- package/build/utils/projectMetadata.js +188 -0
- package/build/utils/projectMetadata.test.js +81 -0
- package/build/utils/repoScanner.js +378 -0
- package/build/utils/routeParsers.js +213 -0
- package/build/utils/routeParsers.test.js +87 -0
- package/build/utils/scenarioDrafting.js +119 -0
- package/build/utils/scenarioDrafting.test.js +66 -0
- package/build/utils/trace-parser.js +166 -0
- package/build/utils/workspaceAuth.js +16 -0
- package/package.json +1 -1
- package/build/prompts/test-recommendation/repository-analysis-prompt.js +0 -326
- package/build/prompts/test-recommendation/test-mapping-prompt.js +0 -266
- package/build/tools/test-recommendation/mapTestsTool.js +0 -243
- package/build/types/TestMapping.js +0 -173
- package/build/utils/scoring-engine.js +0 -380
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repository Analysis Prompt
|
|
3
|
-
* Comprehensive prompt for analyzing code repositories
|
|
4
|
-
*/
|
|
5
|
-
export function getRepositoryAnalysisPrompt(repositoryPath, analysisScope = "full_repo", parsedDiff) {
|
|
6
|
-
const isDiffScope = analysisScope === "current_branch_diff";
|
|
7
|
-
return `
|
|
8
|
-
Analyze this repository systematically using the guide below.
|
|
9
|
-
|
|
10
|
-
REPOSITORY PATH: ${repositoryPath}
|
|
11
|
-
ANALYSIS SCOPE: ${analysisScope}${isDiffScope ? " (focus on branch changes only)" : " (full repository)"}
|
|
12
|
-
|
|
13
|
-
IMPORTANT OUTPUT FORMAT:
|
|
14
|
-
- Return analysis as valid JSON matching the RepositoryAnalysis interface
|
|
15
|
-
- Use empty arrays [] for unavailable data rather than omitting fields
|
|
16
|
-
- Use "unknown" for unknown string values
|
|
17
|
-
- Provide evidence (file paths, line numbers) where possible
|
|
18
|
-
${isDiffScope ? '- MUST include the "branchDiffContext" field in the output JSON' : ""}
|
|
19
|
-
|
|
20
|
-
## CRITICAL RULES
|
|
21
|
-
- If user flows are defined in documentation explicitly, follow them strictly and do not generate new ones.
|
|
22
|
-
${isDiffScope ? `- Do NOT run git commands — the diff has already been parsed by the tool
|
|
23
|
-
- Still gather full repo context (tech stack, infra, auth, existing tests) for accurate scoring
|
|
24
|
-
- For branchDiffContext, use the following pre-parsed metadata:
|
|
25
|
-
- currentBranch: "${parsedDiff?.currentBranch || "unknown"}"
|
|
26
|
-
- baseBranch: "${parsedDiff?.baseBranch || "main"}"
|
|
27
|
-
- changedFiles: [${parsedDiff?.changedFiles.map((f) => `"${f}"`).join(", ") || ""}]
|
|
28
|
-
- For newEndpoints and modifiedEndpoints: use the pre-parsed endpoint information provided by the tool as the primary source of truth.
|
|
29
|
-
- You may refine this list using only the metadata and code/context that is explicitly included in this prompt.
|
|
30
|
-
- Do NOT attempt to scan or open additional repository files beyond what has been provided here.
|
|
31
|
-
- It is acceptable if some indirect or transitive impacts are not fully captured; do not speculate beyond the available information.
|
|
32
|
-
- When you adjust endpoints, clearly explain your reasoning based on the pre-parsed data and any in-prompt context.
|
|
33
|
-
- affectedServices: treat the changed file paths as high-level hints about which services are likely impacted, but do not perform exhaustive dependency tracing beyond the information provided` : ""}
|
|
34
|
-
|
|
35
|
-
# Repository Analysis Guide
|
|
36
|
-
|
|
37
|
-
## 1. Initial Repository Analysis
|
|
38
|
-
|
|
39
|
-
### Documentation
|
|
40
|
-
Review documentation files for any project-specific details and instructions
|
|
41
|
-
|
|
42
|
-
### Project Type
|
|
43
|
-
Identify what kind of application this is:
|
|
44
|
-
- REST API service
|
|
45
|
-
- Frontend application (React/Vue/Angular)
|
|
46
|
-
- Full-stack application
|
|
47
|
-
- Library/SDK
|
|
48
|
-
- CLI tool
|
|
49
|
-
- Microservices
|
|
50
|
-
- Other (describe)
|
|
51
|
-
|
|
52
|
-
### Primary Technology Stack
|
|
53
|
-
- **Language**: Identify the primary programming language(s)
|
|
54
|
-
- **Framework**: Identify the main framework(s) used
|
|
55
|
-
- **Key Dependencies**: List critical dependencies from package files
|
|
56
|
-
|
|
57
|
-
### Main Purpose
|
|
58
|
-
Describe what this application does in 1-2 sentences.
|
|
59
|
-
|
|
60
|
-
### Business Logic
|
|
61
|
-
- **Common User Flows**: How do users typically interact with this system?
|
|
62
|
-
- Infer from documentation, endpoint analysis, and code structure
|
|
63
|
-
- **Common Data Flows**: How does data move through the system?
|
|
64
|
-
- **Common Integration Patterns**: How does this system integrate with other services?
|
|
65
|
-
|
|
66
|
-
## 2. Artifact Discovery
|
|
67
|
-
|
|
68
|
-
### OpenAPI/Swagger Specifications
|
|
69
|
-
**Search Patterns:**
|
|
70
|
-
- \`**/*{openapi,swagger}*.{yaml,yml,json}\`
|
|
71
|
-
- \`**/api-spec.{yaml,yml,json}\`
|
|
72
|
-
- \`**/docs/**/*.{yaml,yml,json}\`
|
|
73
|
-
|
|
74
|
-
**Extract:**
|
|
75
|
-
- OpenAPI/Swagger version
|
|
76
|
-
- Total endpoint count
|
|
77
|
-
- Base URL(s)
|
|
78
|
-
- Authentication schemes
|
|
79
|
-
- Paths and operations
|
|
80
|
-
|
|
81
|
-
### Playwright Recordings
|
|
82
|
-
**Search Patterns:**
|
|
83
|
-
- \`**/*.zip\` in \`/recordings/\`, \`/tests/\`, \`/e2e/\` directories
|
|
84
|
-
|
|
85
|
-
### API Trace Files
|
|
86
|
-
**Search Patterns:**
|
|
87
|
-
- \`**/*trace*.json\` - JSON trace files
|
|
88
|
-
- \`**/*.har\` - HAR (HTTP Archive) files
|
|
89
|
-
- \`**/traces/**/*.json\` - Trace directories
|
|
90
|
-
|
|
91
|
-
## 3. API Endpoint Discovery
|
|
92
|
-
|
|
93
|
-
### If OpenAPI Spec Available
|
|
94
|
-
- Parse all paths and operations
|
|
95
|
-
- Extract: path, HTTP methods, authentication requirements, path parameters
|
|
96
|
-
- Count total endpoints
|
|
97
|
-
- Identify base URL from servers section
|
|
98
|
-
- Detect authentication type (bearer, api_key, oauth2, basic)
|
|
99
|
-
|
|
100
|
-
### If No OpenAPI Spec
|
|
101
|
-
Scan code for route definitions based on framework:
|
|
102
|
-
|
|
103
|
-
**Express (Node.js):**
|
|
104
|
-
- Patterns: \`app.get(\`, \`app.post(\`, \`router.get(\`, \`router.post(\`
|
|
105
|
-
|
|
106
|
-
**FastAPI (Python):**
|
|
107
|
-
- Patterns: \`@app.get(\`, \`@router.post(\`, \`@app.put(\`
|
|
108
|
-
|
|
109
|
-
**Spring (Java):**
|
|
110
|
-
- Patterns: \`@GetMapping\`, \`@PostMapping\`, \`@RestController\`, \`@RequestMapping\`
|
|
111
|
-
|
|
112
|
-
**Django (Python):**
|
|
113
|
-
- Patterns: \`path(\`, \`url(\` in \`urls.py\` files
|
|
114
|
-
|
|
115
|
-
**Flask (Python):**
|
|
116
|
-
- Patterns: \`@app.route(\`, \`@blueprint.route(\`
|
|
117
|
-
|
|
118
|
-
## 4. Authentication Analysis
|
|
119
|
-
|
|
120
|
-
Investigate how the application handles authentication and authorization.
|
|
121
|
-
|
|
122
|
-
### Look For:
|
|
123
|
-
- Environment variables: \`API_KEY\`, \`TOKEN\`, \`SECRET\`, \`AUTH_\`, \`JWT_\`
|
|
124
|
-
- Authentication middleware or decorators
|
|
125
|
-
- JWT handling libraries
|
|
126
|
-
- OAuth configuration files
|
|
127
|
-
- API key validation logic
|
|
128
|
-
- Session management
|
|
129
|
-
|
|
130
|
-
### Identify:
|
|
131
|
-
1. **Authentication Method**: Bearer token, API key, OAuth 2.0, Basic Auth, JWT, etc.
|
|
132
|
-
2. **Configuration Location**: Where auth is configured (env files, config files, middleware)
|
|
133
|
-
3. **Credential Setup**: How to set authentication credentials
|
|
134
|
-
|
|
135
|
-
## 5. Infrastructure Analysis
|
|
136
|
-
|
|
137
|
-
Analyze deployment and infrastructure configuration.
|
|
138
|
-
|
|
139
|
-
### Containerization
|
|
140
|
-
**Check for:**
|
|
141
|
-
- \`Dockerfile\`
|
|
142
|
-
- \`docker-compose.yml\`
|
|
143
|
-
- \`.dockerignore\`
|
|
144
|
-
|
|
145
|
-
### Orchestration
|
|
146
|
-
**Kubernetes:**
|
|
147
|
-
- Check for manifests in \`k8s/\`, \`kubernetes/\`, or \`.yaml\` files with \`kind: Deployment\`
|
|
148
|
-
|
|
149
|
-
**Docker Compose:**
|
|
150
|
-
- Check for multi-service setup
|
|
151
|
-
|
|
152
|
-
### CI/CD
|
|
153
|
-
**Identify platforms from config files:**
|
|
154
|
-
- GitHub Actions: \`.github/workflows/\`
|
|
155
|
-
- GitLab CI: \`.gitlab-ci.yml\`
|
|
156
|
-
- Jenkins: \`Jenkinsfile\`
|
|
157
|
-
- CircleCI: \`.circleci/config.yml\`
|
|
158
|
-
- Travis CI: \`.travis.yml\`
|
|
159
|
-
|
|
160
|
-
### Deployment Pattern Inference
|
|
161
|
-
- **Microservices**: Kubernetes AND multiple services detected
|
|
162
|
-
- **Full-stack**: Docker Compose AND both API and Frontend components detected
|
|
163
|
-
- **Containerized Monolith**: Single Dockerfile only (no compose, no K8s)
|
|
164
|
-
- **Traditional**: No container configurations found
|
|
165
|
-
|
|
166
|
-
## 6. Existing Test Analysis
|
|
167
|
-
|
|
168
|
-
Analyze the testing infrastructure and coverage.
|
|
169
|
-
|
|
170
|
-
### Test Directory Detection
|
|
171
|
-
**Search Patterns:**
|
|
172
|
-
- \`**/test/**\`
|
|
173
|
-
- \`**/tests/**\`
|
|
174
|
-
- \`**/__tests__/**\`
|
|
175
|
-
- \`**/spec/**\`
|
|
176
|
-
|
|
177
|
-
**Count test files:**
|
|
178
|
-
- \`**/*{.test,.spec}.{ts,js,tsx,jsx,py,java,go}\`
|
|
179
|
-
|
|
180
|
-
### Test Framework Detection
|
|
181
|
-
**Configuration Files:**
|
|
182
|
-
- \`pytest.ini\`, \`setup.cfg\` (pytest)
|
|
183
|
-
- \`jest.config.js\`, \`jest.config.ts\` (Jest)
|
|
184
|
-
- \`karma.conf.js\` (Karma)
|
|
185
|
-
- \`playwright.config.ts\` (Playwright)
|
|
186
|
-
- \`cypress.config.js\` (Cypress)
|
|
187
|
-
|
|
188
|
-
### Test Type Inference
|
|
189
|
-
**File Name Patterns:**
|
|
190
|
-
- **Unit Tests**: \`*unit*.{test,spec}\`, \`*.unit.*\`
|
|
191
|
-
- **Integration Tests**: \`*integration*.{test,spec}\`, \`*.integration.*\`
|
|
192
|
-
- **E2E Tests**: \`*e2e*.{test,spec}\`, \`*end-to-end*\`, \`*.e2e.*\`
|
|
193
|
-
- **Smoke Tests**: \`*smoke*.{test,spec}\`
|
|
194
|
-
- **Load Tests**: \`*load*.{test,spec}\`, \`*performance*\`
|
|
195
|
-
|
|
196
|
-
## OUTPUT STRUCTURE
|
|
197
|
-
|
|
198
|
-
Return a JSON object with this exact structure:
|
|
199
|
-
|
|
200
|
-
\`\`\`json
|
|
201
|
-
{
|
|
202
|
-
"metadata": {
|
|
203
|
-
"repositoryName": "name-from-path",
|
|
204
|
-
"analysisDate": "2025-10-15T14:30:00Z",
|
|
205
|
-
"scanDepth": "full",
|
|
206
|
-
"analysisScope": "${analysisScope}"
|
|
207
|
-
},
|
|
208
|
-
"projectClassification": {
|
|
209
|
-
"projectType": "rest-api | frontend | full-stack | microservices | library | cli | other",
|
|
210
|
-
"primaryLanguage": "language",
|
|
211
|
-
"primaryFramework": "framework",
|
|
212
|
-
"deploymentPattern": "microservices | full-stack | containerized-monolith | traditional | unknown"
|
|
213
|
-
},
|
|
214
|
-
"technologyStack": {
|
|
215
|
-
"languages": ["language1", "language2"],
|
|
216
|
-
"frameworks": ["framework1", "framework2"],
|
|
217
|
-
"runtime": "runtime version",
|
|
218
|
-
"keyDependencies": [
|
|
219
|
-
{ "name": "dep1", "version": "1.0.0", "purpose": "description" }
|
|
220
|
-
]
|
|
221
|
-
},
|
|
222
|
-
"businessContext": {
|
|
223
|
-
"mainPurpose": "1-2 sentence description",
|
|
224
|
-
"userFlows": ["flow1", "flow2"],
|
|
225
|
-
"dataFlows": ["flow1", "flow2"],
|
|
226
|
-
"integrationPatterns": ["pattern1", "pattern2"]
|
|
227
|
-
},
|
|
228
|
-
"artifacts": {
|
|
229
|
-
"openApiSpecs": [
|
|
230
|
-
{
|
|
231
|
-
"path": "./docs/openapi.yaml",
|
|
232
|
-
"version": "3.0.0",
|
|
233
|
-
"endpointCount": 18,
|
|
234
|
-
"baseUrl": "http://localhost:3000/api/v1",
|
|
235
|
-
"authType": "bearer"
|
|
236
|
-
}
|
|
237
|
-
],
|
|
238
|
-
"playwrightRecordings": [],
|
|
239
|
-
"traceFiles": [
|
|
240
|
-
{
|
|
241
|
-
"path": "./traces/user-session.json",
|
|
242
|
-
"format": "json"
|
|
243
|
-
}
|
|
244
|
-
],
|
|
245
|
-
"notFound": ["Playwright recordings"]
|
|
246
|
-
},
|
|
247
|
-
"apiEndpoints": {
|
|
248
|
-
"totalCount": 18,
|
|
249
|
-
"baseUrl": "http://localhost:3000/api",
|
|
250
|
-
"endpoints": [
|
|
251
|
-
{
|
|
252
|
-
"path": "/users",
|
|
253
|
-
"method": "GET",
|
|
254
|
-
"resourceGroup": "Users",
|
|
255
|
-
"authRequired": true,
|
|
256
|
-
"sourceFile": "src/routes/user.js:10"
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
},
|
|
260
|
-
"authentication": {
|
|
261
|
-
"method": "bearer | api-key | oauth2 | basic | jwt | none",
|
|
262
|
-
"configLocation": "path/to/config",
|
|
263
|
-
"envVarsRequired": ["VAR1", "VAR2"],
|
|
264
|
-
"setupExample": "export API_KEY=value"
|
|
265
|
-
},
|
|
266
|
-
"infrastructure": {
|
|
267
|
-
"isContainerized": true,
|
|
268
|
-
"hasDockerCompose": true,
|
|
269
|
-
"hasKubernetes": false,
|
|
270
|
-
"hasCiCd": true,
|
|
271
|
-
"ciCdPlatform": "github-actions"
|
|
272
|
-
},
|
|
273
|
-
"existingTests": {
|
|
274
|
-
"frameworks": ["jest", "supertest"],
|
|
275
|
-
"coverage": {
|
|
276
|
-
"unit": 45,
|
|
277
|
-
"integration": 0,
|
|
278
|
-
"e2e": 0,
|
|
279
|
-
"ui": 0,
|
|
280
|
-
"load": 0,
|
|
281
|
-
"contract": 0,
|
|
282
|
-
"smoke": 0
|
|
283
|
-
},
|
|
284
|
-
"testLocations": {
|
|
285
|
-
"unit": "src/tests/unit/"
|
|
286
|
-
},
|
|
287
|
-
"hasCoverageReports": true,
|
|
288
|
-
"estimatedCoverage": 78
|
|
289
|
-
}${isDiffScope ? `,
|
|
290
|
-
"branchDiffContext": {
|
|
291
|
-
"currentBranch": "feature/my-feature",
|
|
292
|
-
"baseBranch": "main",
|
|
293
|
-
"changedFiles": ["src/routes/products.ts", "src/models/Product.ts"],
|
|
294
|
-
"newEndpoints": [
|
|
295
|
-
{ "path": "/api/v1/products/search", "method": "GET", "sourceFile": "src/routes/products.ts:45" }
|
|
296
|
-
],
|
|
297
|
-
"modifiedEndpoints": [
|
|
298
|
-
{ "path": "/api/v1/products", "method": "POST", "sourceFile": "src/routes/products.ts:12" }
|
|
299
|
-
],
|
|
300
|
-
"affectedServices": ["product-service"],
|
|
301
|
-
"summary": "Added product search endpoint and modified product creation validation"
|
|
302
|
-
}` : ""}
|
|
303
|
-
}
|
|
304
|
-
\`\`\`
|
|
305
|
-
|
|
306
|
-
VALIDATION CHECKLIST:
|
|
307
|
-
- [ ] Project type identified with evidence
|
|
308
|
-
- [ ] All artifacts searched with file paths
|
|
309
|
-
- [ ] API endpoints counted and categorized
|
|
310
|
-
- [ ] Authentication method determined
|
|
311
|
-
- [ ] Infrastructure flags verified
|
|
312
|
-
- [ ] Existing tests catalogued${isDiffScope ? `
|
|
313
|
-
- [ ] branchDiffContext.changedFiles matches the list provided above
|
|
314
|
-
- [ ] branchDiffContext.modifiedEndpoints includes ALL endpoints whose behaviour changed — including those affected by model/schema/validator changes (trace: changed file → which models/types → which endpoints use them)
|
|
315
|
-
- [ ] branchDiffContext.newEndpoints includes any brand-new routes added in the diff
|
|
316
|
-
- [ ] branchDiffContext.summary describes what changed in plain English` : ""}
|
|
317
|
-
|
|
318
|
-
**CRITICAL INSTRUCTIONS**:
|
|
319
|
-
- Construct the complete RepositoryAnalysis JSON object.
|
|
320
|
-
- DO NOT create any .md or documentation files.
|
|
321
|
-
- Save the analysis JSON to the state file path provided in the tool response.
|
|
322
|
-
- Then call \`skyramp_map_tests\` with the \`stateFile\` parameter (NOT analysisReport) to avoid serialization issues.
|
|
323
|
-
|
|
324
|
-
Begin analysis now.
|
|
325
|
-
`;
|
|
326
|
-
}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { BASE_SCORES, CONTEXT_RULES } from "../../types/TestMapping.js";
|
|
2
|
-
/**
|
|
3
|
-
* Test Mapping Prompt
|
|
4
|
-
* Prompt for calculating test priority scores
|
|
5
|
-
*/
|
|
6
|
-
export function getTestMappingPrompt(analysis) {
|
|
7
|
-
return `
|
|
8
|
-
Calculate priority scores for Skyramp test types based on repository analysis results and the test definitions below.
|
|
9
|
-
|
|
10
|
-
## CRITICAL RULES
|
|
11
|
-
- Do not suggest test scenarios at this stage.
|
|
12
|
-
|
|
13
|
-
# Skyramp Test Types & Requirements
|
|
14
|
-
|
|
15
|
-
Skyramp offers comprehensive testing capabilities across multiple test types.
|
|
16
|
-
Each test type serves specific purposes and requires different inputs for generation.
|
|
17
|
-
|
|
18
|
-
## 1. Smoke Tests (Base Score: ${BASE_SCORES.smoke})
|
|
19
|
-
|
|
20
|
-
**Purpose**: Quickly verify that an endpoint is accessible and returns a valid response. Ideal for identifying critical defects after significant changes.
|
|
21
|
-
|
|
22
|
-
**Required Inputs**:
|
|
23
|
-
- **OpenAPI Schema** (JSON/YAML) - API specification file
|
|
24
|
-
- **Sample Request Data** (Optional) - JSON blob or file for request body
|
|
25
|
-
- **Endpoint URL** - Target endpoint to test
|
|
26
|
-
- **HTTP Method** (Optional) - Specific method to test
|
|
27
|
-
|
|
28
|
-
**Use Cases**:
|
|
29
|
-
- Post-deployment verification
|
|
30
|
-
- Quick health checks
|
|
31
|
-
- Critical path validation
|
|
32
|
-
|
|
33
|
-
## 2. Contract Tests (Base Score: ${BASE_SCORES.contract})
|
|
34
|
-
|
|
35
|
-
**Purpose**: Ensure services adhere to agreed-upon API contracts, preventing integration issues between services.
|
|
36
|
-
|
|
37
|
-
**Required Inputs**:
|
|
38
|
-
- **OpenAPI Schema** (JSON/YAML) - API specification file
|
|
39
|
-
- **Endpoint URL** - Target endpoint to test
|
|
40
|
-
- **Response Validation** (Optional) - Expected response structure
|
|
41
|
-
|
|
42
|
-
**Use Cases**:
|
|
43
|
-
- API compatibility validation
|
|
44
|
-
- Service contract enforcement
|
|
45
|
-
- Breaking change detection
|
|
46
|
-
|
|
47
|
-
## 3. Fuzz Tests (Base Score: ${BASE_SCORES.fuzz})
|
|
48
|
-
|
|
49
|
-
**Purpose**: Identify vulnerabilities and unexpected behaviors by sending random or invalid data to the application.
|
|
50
|
-
|
|
51
|
-
**Required Inputs**:
|
|
52
|
-
- **OpenAPI Schema** (JSON/YAML) - API specification file
|
|
53
|
-
- **Endpoint URL** - Target endpoint to test
|
|
54
|
-
- **Fuzz Parameters** (Optional) - Custom fuzzing configuration
|
|
55
|
-
|
|
56
|
-
**Use Cases**:
|
|
57
|
-
- Security vulnerability testing
|
|
58
|
-
- Input validation verification
|
|
59
|
-
- Edge case discovery
|
|
60
|
-
|
|
61
|
-
## 4. Integration Tests (Base Score: ${BASE_SCORES.integration})
|
|
62
|
-
|
|
63
|
-
**Purpose**: Verify that different components of a system work together as expected, ensuring reliable data flow and system behavior.
|
|
64
|
-
|
|
65
|
-
**Required Inputs**:
|
|
66
|
-
- **OpenAPI Schema** (JSON/YAML) - API specification file
|
|
67
|
-
- **Endpoint URL** - Target endpoint to test
|
|
68
|
-
- **Integration Scenarios** (Optional) - Specific integration flows
|
|
69
|
-
|
|
70
|
-
**Use Cases**:
|
|
71
|
-
- Microservices integration
|
|
72
|
-
- Database connectivity testing
|
|
73
|
-
- External API integration
|
|
74
|
-
|
|
75
|
-
## 5. Load Tests (Base Score: ${BASE_SCORES.load})
|
|
76
|
-
|
|
77
|
-
**Purpose**: Assess performance and scalability under various load conditions.
|
|
78
|
-
|
|
79
|
-
**Required Inputs**:
|
|
80
|
-
- **OpenAPI Schema** (JSON/YAML) - API specification file
|
|
81
|
-
- **Endpoint URL** - Target endpoint to test
|
|
82
|
-
- **Load Parameters**:
|
|
83
|
-
- \`--load-duration\` (default: 5 seconds)
|
|
84
|
-
- \`--load-num-threads\` (default: 1)
|
|
85
|
-
- \`--load-target-rps\` (requests per second)
|
|
86
|
-
- \`--load-rampup-duration\` (gradual load increase)
|
|
87
|
-
|
|
88
|
-
**Use Cases**:
|
|
89
|
-
- Performance benchmarking
|
|
90
|
-
- Scalability assessment
|
|
91
|
-
- Stress testing
|
|
92
|
-
|
|
93
|
-
## 6. UI Tests (Base Score: ${BASE_SCORES.ui})
|
|
94
|
-
|
|
95
|
-
**Purpose**: Validate user interface functionality and user experience.
|
|
96
|
-
|
|
97
|
-
**Required Inputs**:
|
|
98
|
-
- **Playwright Recording** - ZIP file containing UI interaction traces
|
|
99
|
-
- **Browser Context** (Optional) - Specific browser/device configurations
|
|
100
|
-
|
|
101
|
-
**Use Cases**:
|
|
102
|
-
- User workflow validation
|
|
103
|
-
- Cross-browser compatibility
|
|
104
|
-
- UI regression testing
|
|
105
|
-
|
|
106
|
-
## 7. End-to-End (E2E) Tests (Base Score: ${BASE_SCORES.e2e})
|
|
107
|
-
|
|
108
|
-
**Purpose**: Test complete application flow from start to finish, ensuring all integrated components function as expected.
|
|
109
|
-
|
|
110
|
-
**Required Inputs**:
|
|
111
|
-
- **Trace File** - JSON file containing API interactions
|
|
112
|
-
- **Playwright Recording** - ZIP file containing UI interactions
|
|
113
|
-
- **Integration Scenarios** - Complete user journey definitions
|
|
114
|
-
|
|
115
|
-
**Use Cases**:
|
|
116
|
-
- Complete user journey testing
|
|
117
|
-
- Full-stack integration validation
|
|
118
|
-
- Business process verification
|
|
119
|
-
|
|
120
|
-
## Test Type Priority Hierarchy (Base Impact Score)
|
|
121
|
-
|
|
122
|
-
Based on impact and value:
|
|
123
|
-
|
|
124
|
-
1. **E2E Tests: ${BASE_SCORES.e2e}**
|
|
125
|
-
- Highest value: validates complete user journeys
|
|
126
|
-
- Catches integration issues across full stack
|
|
127
|
-
- Most realistic representation of user experience
|
|
128
|
-
|
|
129
|
-
2. **UI Tests: ${BASE_SCORES.ui}**
|
|
130
|
-
- Critical for user-facing functionality
|
|
131
|
-
- Prevents UI regressions
|
|
132
|
-
- Validates actual user interactions
|
|
133
|
-
|
|
134
|
-
3. **Integration Tests: ${BASE_SCORES.integration}**
|
|
135
|
-
- Validates component interactions
|
|
136
|
-
- Catches interface mismatches
|
|
137
|
-
- Tests realistic workflows
|
|
138
|
-
|
|
139
|
-
4. **Load Tests: ${BASE_SCORES.load}**
|
|
140
|
-
- Ensures performance under pressure
|
|
141
|
-
- Prevents production outages from traffic spikes
|
|
142
|
-
- Validates scalability
|
|
143
|
-
|
|
144
|
-
5. **Fuzz Tests: ${BASE_SCORES.fuzz}**
|
|
145
|
-
- Uncovers security vulnerabilities
|
|
146
|
-
- Finds edge cases
|
|
147
|
-
- Validates input handling
|
|
148
|
-
|
|
149
|
-
6. **Contract Tests: ${BASE_SCORES.contract}**
|
|
150
|
-
- Prevents API breaking changes
|
|
151
|
-
- Ensures service compatibility
|
|
152
|
-
- Important for microservices
|
|
153
|
-
|
|
154
|
-
7. **Smoke Tests: ${BASE_SCORES.smoke}**
|
|
155
|
-
- Basic verification only
|
|
156
|
-
- Quick feedback but shallow coverage
|
|
157
|
-
- Catches only obvious failures
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Contextual Score Adjustment by Test Type
|
|
162
|
-
|
|
163
|
-
### Scoring Formula
|
|
164
|
-
\`\`\`
|
|
165
|
-
_finalScore = _baseScore × contextMultiplier
|
|
166
|
-
\`\`\`
|
|
167
|
-
|
|
168
|
-
### E2E Tests Context Multipliers
|
|
169
|
-
- **Full-stack application**: ×1.2 (full value)
|
|
170
|
-
- **Backend-only API**: ×0.7 (reduced, no UI to test end-to-end)
|
|
171
|
-
- **Frontend SPA without backend**: ×0.9 (slightly reduced)
|
|
172
|
-
- **Library/SDK**: ×0 (not applicable)
|
|
173
|
-
|
|
174
|
-
### UI Tests Context Multipliers
|
|
175
|
-
- **Frontend SPA or full-stack**: ×1.2 (full value)
|
|
176
|
-
- **Backend-only**: ×0 (not applicable)
|
|
177
|
-
|
|
178
|
-
### Integration Tests Context Multipliers
|
|
179
|
-
- **Full-stack application**: ×1.2 (full value)
|
|
180
|
-
- **Microservices**: ×1.1 (service communication important)
|
|
181
|
-
- **Has unit tests, missing integration**: ×1.2 (fill coverage gap)
|
|
182
|
-
|
|
183
|
-
### Load Tests Context Multipliers
|
|
184
|
-
- **Has Kubernetes or Docker Compose**: ×1.2 (scaled infrastructure suggests high traffic)
|
|
185
|
-
- **Daily deployments**: ×1.15 (frequent deploys need performance validation)
|
|
186
|
-
- **CLI tool or library**: ×0.4 (low traffic expected)
|
|
187
|
-
- **Internal tool (<10 users)**: ×0.4 (minimal load)
|
|
188
|
-
|
|
189
|
-
### Fuzz Tests Context Multipliers
|
|
190
|
-
- **Handles payments or PII**: ×1.2 (security critical)
|
|
191
|
-
- **OAuth2 authentication**: ×1.15 (public API indicator)
|
|
192
|
-
- **Public-facing API**: ×1.2 (higher security needs)
|
|
193
|
-
- **Internal service**: ×0.9 (lower security priority)
|
|
194
|
-
|
|
195
|
-
### Contract Tests Context Multipliers
|
|
196
|
-
- **Microservices architecture**: ×1.2 (critical for service contracts)
|
|
197
|
-
- **Multiple services detected**: ×1.15 (service interactions important)
|
|
198
|
-
- **Monolithic application**: ×0.9 (less critical)
|
|
199
|
-
|
|
200
|
-
### Smoke Tests Context Multipliers
|
|
201
|
-
- **No existing tests**: ×1.2 (quick wins needed)
|
|
202
|
-
- **Production system**: ×1.1 (deployment validation)
|
|
203
|
-
- **Already has comprehensive tests**: ×0.8 (less valuable)
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Context Multiplier Rules (Programmatic)
|
|
208
|
-
|
|
209
|
-
${generateContextRulesTable()}
|
|
210
|
-
|
|
211
|
-
## Repository Analysis
|
|
212
|
-
|
|
213
|
-
\`\`\`json
|
|
214
|
-
${JSON.stringify(analysis, null, 2)}
|
|
215
|
-
\`\`\`
|
|
216
|
-
|
|
217
|
-
## Your Task
|
|
218
|
-
|
|
219
|
-
Calculate priority scores for ALL test types and return a JSON object with this structure:
|
|
220
|
-
|
|
221
|
-
\`\`\`json
|
|
222
|
-
{
|
|
223
|
-
"priorityScores": [
|
|
224
|
-
{
|
|
225
|
-
"testType": "integration",
|
|
226
|
-
"_baseScore": 85,
|
|
227
|
-
"contextMultiplier": 1.2,
|
|
228
|
-
"_finalScore": 102,
|
|
229
|
-
"feasibility": "high",
|
|
230
|
-
"requiredArtifacts": {
|
|
231
|
-
"available": ["openApiSpec"],
|
|
232
|
-
"missing": []
|
|
233
|
-
},
|
|
234
|
-
"reasoning": "Detailed explanation of why this score was calculated"
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"contextFactors": {
|
|
238
|
-
"applied": [
|
|
239
|
-
{
|
|
240
|
-
"factor": "hasDockerCompose",
|
|
241
|
-
"impact": "Increases integration test importance",
|
|
242
|
-
"multiplier": 1.1
|
|
243
|
-
}
|
|
244
|
-
]
|
|
245
|
-
},
|
|
246
|
-
"summary": {
|
|
247
|
-
"highPriority": ["integration", "fuzz"],
|
|
248
|
-
"mediumPriority": ["contract", "load"],
|
|
249
|
-
"lowPriority": ["smoke"]
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
\`\`\`
|
|
253
|
-
|
|
254
|
-
Calculate scores now. Return ONLY the JSON object, no other text.
|
|
255
|
-
`;
|
|
256
|
-
}
|
|
257
|
-
function generateContextRulesTable() {
|
|
258
|
-
let table = "";
|
|
259
|
-
for (const [testType, rules] of Object.entries(CONTEXT_RULES)) {
|
|
260
|
-
table += `\n**${testType.toUpperCase()} Context Multipliers:**\n`;
|
|
261
|
-
for (const rule of rules) {
|
|
262
|
-
table += `- ${rule.condition}: ×${rule.multiplier} (${rule.description})\n`;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return table;
|
|
266
|
-
}
|