@democratize-quality/mcp-server 1.1.2 → 1.1.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 +17 -47
- package/docs/test-agents.md +673 -0
- package/package.json +2 -1
- package/src/chatmodes//360/237/214/220 api-planner.chatmode.md" +111 -16
- package/src/tools/api/api-generator.js +170 -5
- package/src/tools/api/api-planner.js +1026 -10
- package/src/tools/api/prompts/generation-prompts.js +131 -27
- package/src/tools/api/prompts/healing-prompts.js +56 -4
- package/src/tools/api/prompts/orchestrator.js +5 -4
- package/src/tools/api/prompts/validation-rules.js +90 -2
- package/src/utils/agentInstaller.js +1 -1
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
# API Test Agents
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
Democratize Quality MCP Server comes with three powerful AI-driven API Test Agents: **🌐 api-planner**, **🌐 api-generator**, and **🌐 api-healer**.
|
|
6
|
+
|
|
7
|
+
These agents can be used independently, sequentially, or in a chained workflow to produce comprehensive API test coverage for your applications. Using them together creates a complete test automation pipeline:
|
|
8
|
+
|
|
9
|
+
- **🌐 api-planner** analyzes API schemas (REST/GraphQL) and produces comprehensive test plans
|
|
10
|
+
- **🌐 api-generator** transforms test plans into executable tests (Playwright, Jest, Postman)
|
|
11
|
+
- **🌐 api-healer** diagnoses and automatically repairs failing tests
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
### Installation
|
|
16
|
+
|
|
17
|
+
Install the MCP server with AI testing agents for GitHub Copilot:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx @democratize-quality/mcp-server@latest --agents
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**What this does:**
|
|
24
|
+
- ✅ Installs the MCP server
|
|
25
|
+
- ✅ Sets up 3 AI-powered testing agents
|
|
26
|
+
- ✅ Configures VS Code integration automatically
|
|
27
|
+
- ✅ Creates project folders (`.github/chatmodes/`, `.vscode/`)
|
|
28
|
+
|
|
29
|
+
Once the agents are installed, you can use GitHub Copilot Chat to command these agents to build API tests for both REST and GraphQL APIs.
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
|
|
33
|
+
- Node.js 14+ installed
|
|
34
|
+
- VS Code with GitHub Copilot extension
|
|
35
|
+
- Active internet connection
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🌐 api-planner
|
|
40
|
+
|
|
41
|
+
The **planner agent** analyzes your API (REST or GraphQL) and produces a comprehensive test plan covering multiple scenarios and user flows.
|
|
42
|
+
|
|
43
|
+
### Input
|
|
44
|
+
|
|
45
|
+
- An API schema URL (OpenAPI/Swagger JSON/YAML, or GraphQL introspection endpoint)
|
|
46
|
+
- Clear instructions about what to test (e.g., "Generate a plan for Books and Authors endpoints")
|
|
47
|
+
- (Optional) Authentication requirements
|
|
48
|
+
- (Optional) Specific test categories (functional, security, performance)
|
|
49
|
+
|
|
50
|
+
### Usage
|
|
51
|
+
|
|
52
|
+
**Example: REST API**
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
@🌐 api-planner analyze the OpenAPI spec at
|
|
56
|
+
https://fakerestapi.azurewebsites.net/swagger/v1/swagger.json
|
|
57
|
+
and create a comprehensive test plan focusing on Books and Authors endpoints
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Example: GraphQL API**
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
@🌐 api-planner analyze the GitHub GraphQL API at
|
|
64
|
+
https://api.github.com/graphql
|
|
65
|
+
and create a test plan for repository queries and mutations
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### What It Does
|
|
69
|
+
|
|
70
|
+
1. **Schema Analysis**: Fetches and parses the API schema
|
|
71
|
+
2. **Endpoint Discovery**: Identifies all available endpoints/operations
|
|
72
|
+
3. **Test Scenario Generation**: Creates test cases for:
|
|
73
|
+
- Happy paths (successful operations)
|
|
74
|
+
- Error cases (404, 400, 401, 403)
|
|
75
|
+
- Edge cases (empty lists, boundary values)
|
|
76
|
+
- Data validation scenarios
|
|
77
|
+
4. **Sample Data Generation**: Creates realistic test data using 70+ semantic patterns
|
|
78
|
+
5. **Optional Validation**: Can make actual API calls to validate endpoints
|
|
79
|
+
|
|
80
|
+
### Output
|
|
81
|
+
|
|
82
|
+
A Markdown test plan saved as `./api-test-reports/[api-name]-test-plan.md` containing:
|
|
83
|
+
|
|
84
|
+
- Test scenarios organized by endpoint/operation
|
|
85
|
+
- Sample request bodies with realistic data
|
|
86
|
+
- Expected response structures
|
|
87
|
+
- Error scenarios and edge cases
|
|
88
|
+
- Response time metrics (if validation enabled)
|
|
89
|
+
|
|
90
|
+
**Example Test Plan Section (REST):**
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
### GET /api/v1/Books - Happy Path
|
|
94
|
+
|
|
95
|
+
**Endpoint:** `GET https://fakerestapi.azurewebsites.net/api/v1/Books`
|
|
96
|
+
|
|
97
|
+
**Expected Response (200 OK):**
|
|
98
|
+
```json
|
|
99
|
+
[
|
|
100
|
+
{
|
|
101
|
+
"id": 1,
|
|
102
|
+
"title": "The Great Gatsby",
|
|
103
|
+
"description": "A classic American novel",
|
|
104
|
+
"pageCount": 180,
|
|
105
|
+
"publishDate": "1925-04-10T00:00:00Z"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Example Test Plan Section (GraphQL):**
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
### Query: getRepository - Happy Path
|
|
114
|
+
|
|
115
|
+
**Endpoint:** `POST https://api.github.com/graphql`
|
|
116
|
+
|
|
117
|
+
**Request Body:**
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"query": "query GetRepo($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { name description stargazerCount } }",
|
|
121
|
+
"variables": {
|
|
122
|
+
"owner": "microsoft",
|
|
123
|
+
"name": "playwright"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Expected Response:**
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"data": {
|
|
132
|
+
"repository": {
|
|
133
|
+
"name": "playwright",
|
|
134
|
+
"description": "Playwright is a framework for Web Testing and Automation",
|
|
135
|
+
"stargazerCount": 50000
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 🌐 api-generator
|
|
145
|
+
|
|
146
|
+
The **generator agent** transforms test plans into executable test code. It supports multiple frameworks and can generate tests in TypeScript or JavaScript.
|
|
147
|
+
|
|
148
|
+
### Input
|
|
149
|
+
|
|
150
|
+
- Test plan markdown file (generated by api-planner)
|
|
151
|
+
- Target framework (Playwright, Jest, or Postman)
|
|
152
|
+
- Programming language (TypeScript or JavaScript)
|
|
153
|
+
- Output directory for tests
|
|
154
|
+
|
|
155
|
+
### Usage
|
|
156
|
+
|
|
157
|
+
**Example: Generate Playwright Tests**
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
@🌐 api-generator create Playwright tests in TypeScript from the test plan,
|
|
161
|
+
focusing on the Books API section
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Example: Generate Jest Tests**
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
@🌐 api-generator create Jest tests in JavaScript for the GraphQL operations
|
|
168
|
+
in the test plan
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Example: Generate Postman Collection**
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
@🌐 api-generator create a Postman collection from the entire test plan
|
|
175
|
+
with all endpoints and example requests
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### What It Does
|
|
179
|
+
|
|
180
|
+
1. **Project Detection**: Automatically detects framework and language from your project
|
|
181
|
+
2. **Code Generation**: Creates executable tests based on the test plan
|
|
182
|
+
3. **Selector Verification**: Validates endpoint URLs and request structures
|
|
183
|
+
4. **Framework-Specific Code**: Generates idiomatic code for each framework
|
|
184
|
+
5. **Type Safety**: Includes TypeScript types when applicable
|
|
185
|
+
|
|
186
|
+
### Output
|
|
187
|
+
|
|
188
|
+
**Playwright Tests:**
|
|
189
|
+
```typescript
|
|
190
|
+
// tests/books.spec.ts
|
|
191
|
+
import { test, expect } from '@playwright/test';
|
|
192
|
+
|
|
193
|
+
const BASE_URL = 'https://fakerestapi.azurewebsites.net';
|
|
194
|
+
|
|
195
|
+
test.describe('Books API', () => {
|
|
196
|
+
test('GET /api/v1/Books - should return all books', async ({ request }) => {
|
|
197
|
+
const response = await request.get(`${BASE_URL}/api/v1/Books`);
|
|
198
|
+
expect(response.ok()).toBeTruthy();
|
|
199
|
+
expect(response.status()).toBe(200);
|
|
200
|
+
const books = await response.json();
|
|
201
|
+
expect(Array.isArray(books)).toBeTruthy();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test('POST /api/v1/Books - should create a new book', async ({ request }) => {
|
|
205
|
+
const newBook = {
|
|
206
|
+
id: 201,
|
|
207
|
+
title: "Test Book",
|
|
208
|
+
pageCount: 350
|
|
209
|
+
};
|
|
210
|
+
const response = await request.post(`${BASE_URL}/api/v1/Books`, {
|
|
211
|
+
data: newBook
|
|
212
|
+
});
|
|
213
|
+
expect(response.status()).toBe(200);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Jest Tests:**
|
|
219
|
+
```javascript
|
|
220
|
+
// tests/books.test.js
|
|
221
|
+
const axios = require('axios');
|
|
222
|
+
|
|
223
|
+
const BASE_URL = 'https://fakerestapi.azurewebsites.net';
|
|
224
|
+
|
|
225
|
+
describe('Books API', () => {
|
|
226
|
+
test('GET /api/v1/Books - should return all books', async () => {
|
|
227
|
+
const response = await axios.get(`${BASE_URL}/api/v1/Books`);
|
|
228
|
+
expect(response.status).toBe(200);
|
|
229
|
+
expect(Array.isArray(response.data)).toBeTruthy();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test('POST /api/v1/Books - should create a new book', async () => {
|
|
233
|
+
const newBook = {
|
|
234
|
+
id: 201,
|
|
235
|
+
title: "Test Book",
|
|
236
|
+
pageCount: 350
|
|
237
|
+
};
|
|
238
|
+
const response = await axios.post(`${BASE_URL}/api/v1/Books`, newBook);
|
|
239
|
+
expect(response.status).toBe(200);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Postman Collection:**
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"info": {
|
|
248
|
+
"name": "Fake REST API",
|
|
249
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
250
|
+
},
|
|
251
|
+
"item": [
|
|
252
|
+
{
|
|
253
|
+
"name": "Books",
|
|
254
|
+
"item": [
|
|
255
|
+
{
|
|
256
|
+
"name": "Get All Books",
|
|
257
|
+
"request": {
|
|
258
|
+
"method": "GET",
|
|
259
|
+
"url": "{{baseUrl}}/api/v1/Books"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### GraphQL Test Generation
|
|
269
|
+
|
|
270
|
+
The generator automatically detects GraphQL operations and generates appropriate test code:
|
|
271
|
+
|
|
272
|
+
**Playwright GraphQL Test:**
|
|
273
|
+
```typescript
|
|
274
|
+
test('Query: getRepository - should fetch repository details', async ({ request }) => {
|
|
275
|
+
const response = await request.post('https://api.github.com/graphql', {
|
|
276
|
+
headers: {
|
|
277
|
+
'Content-Type': 'application/json',
|
|
278
|
+
'Authorization': 'Bearer YOUR_TOKEN'
|
|
279
|
+
},
|
|
280
|
+
data: {
|
|
281
|
+
query: `query GetRepo($owner: String!, $name: String!) {
|
|
282
|
+
repository(owner: $owner, name: $name) {
|
|
283
|
+
name
|
|
284
|
+
description
|
|
285
|
+
stargazerCount
|
|
286
|
+
}
|
|
287
|
+
}`,
|
|
288
|
+
variables: {
|
|
289
|
+
owner: 'microsoft',
|
|
290
|
+
name: 'playwright'
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
expect(response.status()).toBe(200);
|
|
296
|
+
const responseData = await response.json();
|
|
297
|
+
expect(responseData).toHaveProperty('data');
|
|
298
|
+
expect(responseData.data.repository.name).toBe('playwright');
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## 🌐 api-healer
|
|
305
|
+
|
|
306
|
+
When tests fail due to API changes, the **healer agent** automatically diagnoses and repairs them.
|
|
307
|
+
|
|
308
|
+
### Input
|
|
309
|
+
|
|
310
|
+
- Path to failing test file(s)
|
|
311
|
+
- Test framework type (auto-detected if not specified)
|
|
312
|
+
- Healing strategies (optional)
|
|
313
|
+
|
|
314
|
+
### Usage
|
|
315
|
+
|
|
316
|
+
**Example: Fix Failing Tests**
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
@🌐 api-healer the Books tests are failing with 404 errors.
|
|
320
|
+
Please analyze and fix them.
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Example: Fix Schema Mismatches**
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
@🌐 api-healer fix assertion errors in tests/users.spec.ts
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### What It Does
|
|
330
|
+
|
|
331
|
+
1. **Error Analysis**: Replays failing tests to identify issues
|
|
332
|
+
2. **Root Cause Detection**: Determines why tests are failing:
|
|
333
|
+
- Endpoint URL changes
|
|
334
|
+
- Schema mismatches (new/removed fields)
|
|
335
|
+
- Data type changes
|
|
336
|
+
- Authentication issues
|
|
337
|
+
- Status code changes
|
|
338
|
+
3. **Automatic Repair**: Applies fixes based on healing strategies
|
|
339
|
+
4. **Verification**: Re-runs tests to ensure they pass
|
|
340
|
+
5. **Backup Creation**: Saves original files before making changes
|
|
341
|
+
|
|
342
|
+
### Healing Strategies
|
|
343
|
+
|
|
344
|
+
| Strategy | What It Fixes |
|
|
345
|
+
|----------|---------------|
|
|
346
|
+
| `endpoint-fix` | Updates changed endpoint URLs and API versions |
|
|
347
|
+
| `schema-update` | Corrects response schema validation (new/removed fields) |
|
|
348
|
+
| `auth-repair` | Fixes authentication headers and token issues |
|
|
349
|
+
| `data-correction` | Adjusts test data types (string vs number, etc.) |
|
|
350
|
+
| `assertion-update` | Updates assertions to match new API behavior |
|
|
351
|
+
|
|
352
|
+
### Output
|
|
353
|
+
|
|
354
|
+
**Analysis Results:**
|
|
355
|
+
```
|
|
356
|
+
Analyzing test failures in tests/books.spec.ts...
|
|
357
|
+
|
|
358
|
+
Issues found:
|
|
359
|
+
❌ Endpoint changed: /api/Books → /api/v1/Books
|
|
360
|
+
❌ Response schema updated: added "pageCount" field
|
|
361
|
+
❌ ID format changed: number → string
|
|
362
|
+
|
|
363
|
+
Applying fixes:
|
|
364
|
+
✅ Updated all endpoint URLs to include /v1/ prefix
|
|
365
|
+
✅ Updated response assertions to include pageCount
|
|
366
|
+
✅ Fixed ID type in test data (42 → "42")
|
|
367
|
+
✅ Backed up original file to tests/books.spec.ts.backup
|
|
368
|
+
|
|
369
|
+
Re-running tests... ✅ All 15 tests now passing!
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Before Healing:**
|
|
373
|
+
```typescript
|
|
374
|
+
test('GET book by ID', async ({ request }) => {
|
|
375
|
+
const response = await request.get(`${BASE_URL}/api/Books/1`);
|
|
376
|
+
expect(response.status()).toBe(200);
|
|
377
|
+
const book = await response.json();
|
|
378
|
+
expect(book).toHaveProperty('id');
|
|
379
|
+
expect(book).toHaveProperty('title');
|
|
380
|
+
// Missing pageCount assertion
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**After Healing:**
|
|
385
|
+
```typescript
|
|
386
|
+
test('GET book by ID', async ({ request }) => {
|
|
387
|
+
const response = await request.get(`${BASE_URL}/api/v1/Books/1`);
|
|
388
|
+
expect(response.status()).toBe(200);
|
|
389
|
+
const book = await response.json();
|
|
390
|
+
expect(book).toHaveProperty('id');
|
|
391
|
+
expect(book).toHaveProperty('title');
|
|
392
|
+
expect(book).toHaveProperty('pageCount'); // Added
|
|
393
|
+
});
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Quick Start Examples
|
|
399
|
+
|
|
400
|
+
### Example 1: Complete REST API Testing Workflow
|
|
401
|
+
|
|
402
|
+
**Testing the Fake REST API** (https://fakerestapi.azurewebsites.net)
|
|
403
|
+
|
|
404
|
+
**Step 1: Create Test Plan**
|
|
405
|
+
```
|
|
406
|
+
@🌐 api-planner analyze the OpenAPI spec at
|
|
407
|
+
https://fakerestapi.azurewebsites.net/swagger/v1/swagger.json
|
|
408
|
+
and create a comprehensive test plan focusing on Books and Authors endpoints
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Step 2: Generate Tests**
|
|
412
|
+
```
|
|
413
|
+
@🌐 api-generator create Playwright tests in TypeScript from the test plan,
|
|
414
|
+
focusing on the Books API section
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**Step 3: Run Tests**
|
|
418
|
+
```bash
|
|
419
|
+
npx playwright test tests/books.spec.ts
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Step 4: Fix Failures (if any)**
|
|
423
|
+
```
|
|
424
|
+
@🌐 api-healer fix the failing tests in tests/books.spec.ts
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Example 2: Complete GraphQL API Testing Workflow
|
|
428
|
+
|
|
429
|
+
**Testing GitHub's GraphQL API** (https://api.github.com/graphql)
|
|
430
|
+
|
|
431
|
+
**Step 1: Create Test Plan**
|
|
432
|
+
```
|
|
433
|
+
@🌐 api-planner analyze the GitHub GraphQL API and create a test plan
|
|
434
|
+
for repository queries including name, description, and stargazer count
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Step 2: Generate Tests**
|
|
438
|
+
```
|
|
439
|
+
@🌐 api-generator create Playwright tests in TypeScript for the
|
|
440
|
+
GraphQL repository queries from the test plan
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Step 3: Run Tests**
|
|
444
|
+
```bash
|
|
445
|
+
GITHUB_TOKEN=your_token npx playwright test tests/github-api.spec.ts
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
**Step 4: Fix Schema Changes (if any)**
|
|
449
|
+
```
|
|
450
|
+
@🌐 api-healer fix tests/github-api.spec.ts to handle schema updates
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Example 3: Generate Postman Collection
|
|
454
|
+
|
|
455
|
+
**Quick API Documentation Workflow**
|
|
456
|
+
|
|
457
|
+
**Step 1: Generate Test Plan with Validation**
|
|
458
|
+
```
|
|
459
|
+
@🌐 api-planner create test plan from
|
|
460
|
+
https://fakerestapi.azurewebsites.net/swagger/v1/swagger.json
|
|
461
|
+
with validation enabled to test actual endpoints
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**Step 2: Generate Postman Collection**
|
|
465
|
+
```
|
|
466
|
+
@🌐 api-generator create Postman collection from the test plan
|
|
467
|
+
with all endpoints and example requests
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**Step 3: Import and Share**
|
|
471
|
+
- Import `postman/FakeRestAPI.postman_collection.json` into Postman
|
|
472
|
+
- Share with your team for manual testing and documentation
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## Artifacts and Conventions
|
|
477
|
+
|
|
478
|
+
The agents follow a structured, auditable file organization:
|
|
479
|
+
|
|
480
|
+
```
|
|
481
|
+
project/
|
|
482
|
+
.github/
|
|
483
|
+
chatmodes/ # Agent definitions (AI prompts)
|
|
484
|
+
🌐 api-planner.chatmode.md
|
|
485
|
+
🌐 api-generator.chatmode.md
|
|
486
|
+
🌐 api-healer.chatmode.md
|
|
487
|
+
.vscode/
|
|
488
|
+
mcp.json # MCP server configuration
|
|
489
|
+
api-test-reports/ # Generated test plans and reports
|
|
490
|
+
fakerest-test-plan.md
|
|
491
|
+
github-test-plan.md
|
|
492
|
+
validation-report.html
|
|
493
|
+
tests/ # Generated test files
|
|
494
|
+
books.spec.ts
|
|
495
|
+
authors.spec.ts
|
|
496
|
+
github-api.spec.ts
|
|
497
|
+
postman/ # Generated Postman collections
|
|
498
|
+
FakeRestAPI.postman_collection.json
|
|
499
|
+
environment.json
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Agent Definitions
|
|
503
|
+
|
|
504
|
+
Agent definitions are markdown files containing:
|
|
505
|
+
- Instructions for the AI agent
|
|
506
|
+
- MCP tool references
|
|
507
|
+
- Best practices and examples
|
|
508
|
+
- Context about the testing workflow
|
|
509
|
+
|
|
510
|
+
They are automatically created by the `--agents` installation and should be committed to version control.
|
|
511
|
+
|
|
512
|
+
### Test Plans in `api-test-reports/`
|
|
513
|
+
|
|
514
|
+
Test plans are structured documents describing:
|
|
515
|
+
- API endpoints/operations
|
|
516
|
+
- Test scenarios (happy path, errors, edge cases)
|
|
517
|
+
- Sample request/response data
|
|
518
|
+
- Expected outcomes
|
|
519
|
+
- Validation results (if enabled)
|
|
520
|
+
|
|
521
|
+
Test plans are human-readable and can be reviewed before code generation.
|
|
522
|
+
|
|
523
|
+
### Tests in `tests/`
|
|
524
|
+
|
|
525
|
+
Generated test files aligned with the test plan structure:
|
|
526
|
+
- One test file per API resource/domain
|
|
527
|
+
- Organized by test categories
|
|
528
|
+
- Include setup/teardown when needed
|
|
529
|
+
- Follow framework best practices
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## Features
|
|
534
|
+
|
|
535
|
+
### Supported API Types
|
|
536
|
+
|
|
537
|
+
✅ **REST APIs** - OpenAPI 2.0/3.0, Swagger
|
|
538
|
+
✅ **GraphQL APIs** - Introspection, SDL schemas
|
|
539
|
+
✅ **Hybrid APIs** - Mix of REST and GraphQL endpoints
|
|
540
|
+
|
|
541
|
+
### Supported Test Frameworks
|
|
542
|
+
|
|
543
|
+
✅ **Playwright** - Modern web automation framework
|
|
544
|
+
✅ **Jest** - Popular JavaScript testing framework
|
|
545
|
+
✅ **Postman** - API testing and documentation tool
|
|
546
|
+
|
|
547
|
+
### Smart Test Data Generation
|
|
548
|
+
|
|
549
|
+
The planner uses **70+ semantic field patterns** to generate realistic test data:
|
|
550
|
+
|
|
551
|
+
| Field Pattern | Generated Value |
|
|
552
|
+
|---------------|-----------------|
|
|
553
|
+
| `email`, `userEmail` | "user@example.com" |
|
|
554
|
+
| `name`, `fullName` | "John Doe" |
|
|
555
|
+
| `phone`, `phoneNumber` | "+1-555-123-4567" |
|
|
556
|
+
| `createdAt`, `updatedAt` | "2025-10-25T12:00:00Z" |
|
|
557
|
+
| `price`, `amount` | 583.39 |
|
|
558
|
+
| `url`, `imageUrl` | "https://example.com/image.jpg" |
|
|
559
|
+
| `description`, `summary` | Meaningful text content |
|
|
560
|
+
| `status`, `state` | Valid enum values |
|
|
561
|
+
|
|
562
|
+
### GraphQL-Specific Features
|
|
563
|
+
|
|
564
|
+
✅ **Full Type System Support** - OBJECT, LIST, NON_NULL, ENUM, UNION, INTERFACE, SCALAR
|
|
565
|
+
✅ **Custom Scalar Detection** - DateTime, URL, Email, JSON
|
|
566
|
+
✅ **Circular Reference Protection** - Handles complex schemas safely
|
|
567
|
+
✅ **Query/Mutation/Subscription Support** - All GraphQL operations
|
|
568
|
+
✅ **Variable Extraction** - Generates typed variables
|
|
569
|
+
✅ **Fragment Support** - Reusable query fragments
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Advanced Usage
|
|
574
|
+
|
|
575
|
+
### Custom Configuration
|
|
576
|
+
|
|
577
|
+
Set environment variables for advanced control:
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
# Output directory for test plans and reports
|
|
581
|
+
OUTPUT_DIR=./custom-reports
|
|
582
|
+
|
|
583
|
+
# Enable debug mode
|
|
584
|
+
MCP_FEATURES_ENABLEDEBUGMODE=true
|
|
585
|
+
|
|
586
|
+
# Node environment
|
|
587
|
+
NODE_ENV=production
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### CI/CD Integration
|
|
591
|
+
|
|
592
|
+
Use agents in automated pipelines:
|
|
593
|
+
|
|
594
|
+
```yaml
|
|
595
|
+
# .github/workflows/api-tests.yml
|
|
596
|
+
name: API Tests
|
|
597
|
+
|
|
598
|
+
on: [push, pull_request]
|
|
599
|
+
|
|
600
|
+
jobs:
|
|
601
|
+
test:
|
|
602
|
+
runs-on: ubuntu-latest
|
|
603
|
+
steps:
|
|
604
|
+
- uses: actions/checkout@v3
|
|
605
|
+
- uses: actions/setup-node@v3
|
|
606
|
+
with:
|
|
607
|
+
node-version: '18'
|
|
608
|
+
|
|
609
|
+
- name: Install dependencies
|
|
610
|
+
run: npm ci
|
|
611
|
+
|
|
612
|
+
- name: Run API tests
|
|
613
|
+
run: npx playwright test tests/
|
|
614
|
+
env:
|
|
615
|
+
API_TOKEN: ${{ secrets.API_TOKEN }}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Multi-Environment Testing
|
|
619
|
+
|
|
620
|
+
Generate tests for different environments:
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
@🌐 api-generator create Jest tests with environment-specific configurations
|
|
624
|
+
for dev (api-dev.example.com), staging (api-staging.example.com),
|
|
625
|
+
and prod (api.example.com) environments
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
---
|
|
629
|
+
|
|
630
|
+
## Video Tutorial
|
|
631
|
+
|
|
632
|
+
<div style="position: relative; padding-bottom: 56.25%; height: 0;">
|
|
633
|
+
<iframe src="https://www.youtube.com/watch?v=aEpdALTMCos" frameborder="0" allowfullscreen
|
|
634
|
+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
|
|
635
|
+
</iframe>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
*Watch a complete walkthrough of using the API Test Agents to build comprehensive test coverage.*
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## Learn More
|
|
643
|
+
|
|
644
|
+
- [Getting Started Guide](./getting-started.md) - Complete setup walkthrough
|
|
645
|
+
- [Tool Reference](./api/tool-reference.md) - Detailed API documentation
|
|
646
|
+
- [GraphQL Support Guide](../GRAPHQL-SUPPORT.md) - GraphQL-specific features
|
|
647
|
+
- [API Tools Usage Guide](./api_tools_usage.md) - Advanced patterns and examples
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
## Community
|
|
652
|
+
|
|
653
|
+
- 📦 [NPM Package](https://www.npmjs.com/package/@democratize-quality/mcp-server)
|
|
654
|
+
- 🐛 [GitHub Issues](https://github.com/uppadhyayraj/democratize-quality-mcp-server/issues)
|
|
655
|
+
- ⭐ [Star on GitHub](https://github.com/uppadhyayraj/democratize-quality-mcp-server)
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
## License
|
|
660
|
+
|
|
661
|
+
MIT License
|
|
662
|
+
|
|
663
|
+
Copyright © 2025 Democratize Quality
|
|
664
|
+
|
|
665
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
666
|
+
|
|
667
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
668
|
+
|
|
669
|
+
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
*This documentation is provided for informational purposes. Users are responsible for ensuring their API testing practices comply with applicable laws, terms of service, and ethical guidelines.*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@democratize-quality/mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "mcpServer.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"democratize-quality-mcp": "cli.js",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"chrome-launcher": "^1.2.0",
|
|
76
76
|
"chrome-remote-interface": "^0.33.3",
|
|
77
77
|
"express": "^5.1.0",
|
|
78
|
+
"graphql": "^16.11.0",
|
|
78
79
|
"json-rpc-2.0": "^1.7.1",
|
|
79
80
|
"yaml": "^2.8.1",
|
|
80
81
|
"zod": "^4.0.10"
|