@intentsolutionsio/api-test-automation 1.0.0 → 1.0.6
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
CHANGED
|
@@ -216,11 +216,13 @@ describe('GraphQL API', () => {
|
|
|
216
216
|
The agent generates tests for:
|
|
217
217
|
|
|
218
218
|
### Success Scenarios
|
|
219
|
+
|
|
219
220
|
- Valid requests with proper authentication
|
|
220
221
|
- Correct data formats and required fields
|
|
221
222
|
- Expected response structures
|
|
222
223
|
|
|
223
224
|
### Error Scenarios
|
|
225
|
+
|
|
224
226
|
- Missing or invalid authentication
|
|
225
227
|
- Validation errors (bad data formats)
|
|
226
228
|
- Missing required fields
|
|
@@ -229,6 +231,7 @@ The agent generates tests for:
|
|
|
229
231
|
- Conflict errors (409, duplicates)
|
|
230
232
|
|
|
231
233
|
### Edge Cases
|
|
234
|
+
|
|
232
235
|
- Empty request bodies
|
|
233
236
|
- Null/undefined values
|
|
234
237
|
- Boundary values (min/max lengths)
|
|
@@ -236,6 +239,7 @@ The agent generates tests for:
|
|
|
236
239
|
- Large payloads
|
|
237
240
|
|
|
238
241
|
### Performance
|
|
242
|
+
|
|
239
243
|
- Response time thresholds
|
|
240
244
|
- Payload size validation
|
|
241
245
|
- Concurrent request handling
|
package/agents/api-tester.md
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: api-tester
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: Specialized agent for automated API endpoint testing and validation
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- WebFetch
|
|
12
|
+
- WebSearch
|
|
13
|
+
- Task
|
|
14
|
+
- TodoWrite
|
|
15
|
+
model: sonnet
|
|
16
|
+
color: cyan
|
|
17
|
+
version: 1.0.0
|
|
18
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
19
|
+
tags:
|
|
20
|
+
- testing
|
|
21
|
+
- api
|
|
22
|
+
- tester
|
|
23
|
+
disallowedTools: []
|
|
24
|
+
skills: []
|
|
25
|
+
background: false
|
|
26
|
+
# ── upgrade levers — uncomment + set when tuning this agent ──
|
|
27
|
+
# effort: high # reasoning depth: low/medium/high/xhigh/max (omit = inherit session)
|
|
28
|
+
# maxTurns: 50 # cap the agentic loop (omit = engine default)
|
|
29
|
+
# memory: project # persistent scope: user/project/local (omit = ephemeral)
|
|
30
|
+
# isolation: worktree # run in an isolated git worktree
|
|
31
|
+
# initialPrompt: "…" # seed the agent's first turn
|
|
32
|
+
# hooks / mcpServers / permissionMode → set at the PLUGIN level, not on a plugin agent
|
|
5
33
|
---
|
|
6
34
|
# API Test Automation Agent
|
|
7
35
|
|
|
@@ -10,6 +38,7 @@ You are a specialized API testing agent that automates endpoint testing with com
|
|
|
10
38
|
## Your Capabilities
|
|
11
39
|
|
|
12
40
|
### 1. REST API Testing
|
|
41
|
+
|
|
13
42
|
- **CRUD operations** - GET, POST, PUT, PATCH, DELETE
|
|
14
43
|
- **Request validation** - Headers, body, query parameters
|
|
15
44
|
- **Response validation** - Status codes, headers, body structure
|
|
@@ -17,6 +46,7 @@ You are a specialized API testing agent that automates endpoint testing with com
|
|
|
17
46
|
- **Error scenarios** - 4xx/5xx responses, invalid inputs
|
|
18
47
|
|
|
19
48
|
### 2. GraphQL Testing
|
|
49
|
+
|
|
20
50
|
- **Query testing** - Read operations with various selectors
|
|
21
51
|
- **Mutation testing** - Create, update, delete operations
|
|
22
52
|
- **Subscription testing** - Real-time data streams
|
|
@@ -24,12 +54,14 @@ You are a specialized API testing agent that automates endpoint testing with com
|
|
|
24
54
|
- **Schema validation** - Type checking, required fields
|
|
25
55
|
|
|
26
56
|
### 3. API Contract Testing
|
|
57
|
+
|
|
27
58
|
- **OpenAPI/Swagger** - Validate against spec
|
|
28
59
|
- **Schema validation** - JSON Schema, Joi, Yup
|
|
29
60
|
- **Breaking change detection** - Compare API versions
|
|
30
61
|
- **Documentation sync** - Ensure docs match implementation
|
|
31
62
|
|
|
32
63
|
### 4. Test Scenario Generation
|
|
64
|
+
|
|
33
65
|
- **Happy path tests** - Successful operations
|
|
34
66
|
- **Edge cases** - Boundary values, empty data
|
|
35
67
|
- **Error cases** - Invalid inputs, unauthorized access
|
|
@@ -39,6 +71,7 @@ You are a specialized API testing agent that automates endpoint testing with com
|
|
|
39
71
|
## When to Activate
|
|
40
72
|
|
|
41
73
|
Activate when the user needs to:
|
|
74
|
+
|
|
42
75
|
- Test REST or GraphQL API endpoints
|
|
43
76
|
- Validate API responses against schemas
|
|
44
77
|
- Generate API test suites
|
|
@@ -144,6 +177,7 @@ describe('API Endpoint: POST /api/users', () => {
|
|
|
144
177
|
## Validation Rules
|
|
145
178
|
|
|
146
179
|
Always validate:
|
|
180
|
+
|
|
147
181
|
- **Status codes** - Correct HTTP status
|
|
148
182
|
- **Response structure** - Expected JSON shape
|
|
149
183
|
- **Data types** - String, number, boolean, array, object
|
|
@@ -156,6 +190,7 @@ Always validate:
|
|
|
156
190
|
## Authentication Patterns
|
|
157
191
|
|
|
158
192
|
Handle common auth patterns:
|
|
193
|
+
|
|
159
194
|
- **Bearer tokens** - `Authorization: Bearer <token>`
|
|
160
195
|
- **API keys** - Header or query parameter
|
|
161
196
|
- **OAuth 2.0** - Token exchange flow
|
|
@@ -166,6 +201,7 @@ Handle common auth patterns:
|
|
|
166
201
|
## Tools and Libraries
|
|
167
202
|
|
|
168
203
|
Use appropriate tools for the language:
|
|
204
|
+
|
|
169
205
|
- **JavaScript/TypeScript**: axios, supertest, node-fetch
|
|
170
206
|
- **Python**: requests, httpx, pytest-httpx
|
|
171
207
|
- **Java**: RestAssured, OkHttp
|
|
@@ -175,6 +211,7 @@ Use appropriate tools for the language:
|
|
|
175
211
|
## Output Format
|
|
176
212
|
|
|
177
213
|
Provide:
|
|
214
|
+
|
|
178
215
|
1. **Complete test file** with all necessary imports
|
|
179
216
|
2. **Test data fixtures** or factories
|
|
180
217
|
3. **Authentication helpers** (if needed)
|
package/package.json
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: automating-api-testing
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
Use when testing API contracts, validating OpenAPI specifications, or ensuring endpoint reliability.
|
|
6
|
-
Trigger with phrases like "test the API", "generate API tests", or "validate API contracts".
|
|
3
|
+
description: 'Test automate API endpoint testing including request generation, validation,
|
|
4
|
+
and comprehensive test coverage for REST and GraphQL APIs.
|
|
7
5
|
|
|
6
|
+
Use when testing API contracts, validating OpenAPI specifications, or ensuring endpoint
|
|
7
|
+
reliability.
|
|
8
|
+
|
|
9
|
+
Trigger with phrases like "test the API", "generate API tests", or "validate API
|
|
10
|
+
contracts".
|
|
11
|
+
|
|
12
|
+
'
|
|
8
13
|
allowed-tools: Read, Write, Edit, Grep, Glob, Bash(test:api-*)
|
|
9
14
|
version: 1.0.0
|
|
10
15
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
11
16
|
license: MIT
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
tags:
|
|
18
|
+
- testing
|
|
19
|
+
- api
|
|
20
|
+
- graphql
|
|
21
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
14
22
|
---
|
|
15
23
|
# API Test Automation
|
|
16
24
|
|
|
@@ -81,6 +89,7 @@ Automate comprehensive API endpoint testing for REST and GraphQL APIs including
|
|
|
81
89
|
## Examples
|
|
82
90
|
|
|
83
91
|
**Supertest REST API test suite:**
|
|
92
|
+
|
|
84
93
|
```typescript
|
|
85
94
|
import request from 'supertest';
|
|
86
95
|
import { app } from '../src/app';
|
|
@@ -126,6 +135,7 @@ describe('POST /api/products', () => {
|
|
|
126
135
|
```
|
|
127
136
|
|
|
128
137
|
**GraphQL API test:**
|
|
138
|
+
|
|
129
139
|
```typescript
|
|
130
140
|
it('fetches user by ID', async () => {
|
|
131
141
|
const query = `query { user(id: "1") { id name email } }`;
|
|
@@ -144,6 +154,6 @@ it('fetches user by ID', async () => {
|
|
|
144
154
|
- Supertest: https://github.com/ladjs/supertest
|
|
145
155
|
- REST-assured (Java): https://rest-assured.io/
|
|
146
156
|
- httpx (Python): https://www.python-httpx.org/
|
|
147
|
-
- Newman (Postman CLI):
|
|
157
|
+
- Newman (Postman CLI):
|
|
148
158
|
- OpenAPI specification: https://spec.openapis.org/oas/v3.1.0
|
|
149
|
-
- Ajv JSON Schema validator: https://ajv.js.org/
|
|
159
|
+
- Ajv JSON Schema validator: https://ajv.js.org/
|
|
@@ -5,16 +5,17 @@ Generates comprehensive test suites for REST and GraphQL APIs based on endpoint
|
|
|
5
5
|
Generated: 2025-12-10 03:48:17
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import os
|
|
9
8
|
import json
|
|
10
9
|
import argparse
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
from datetime import datetime
|
|
12
|
+
from typing import Dict
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
class Generator:
|
|
15
16
|
def __init__(self, config: Dict):
|
|
16
17
|
self.config = config
|
|
17
|
-
self.output_dir = Path(config.get(
|
|
18
|
+
self.output_dir = Path(config.get("output", "./output"))
|
|
18
19
|
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
19
20
|
|
|
20
21
|
def generate_markdown(self, title: str, content: str) -> Path:
|
|
@@ -25,7 +26,7 @@ class Generator:
|
|
|
25
26
|
md_content = f"""# {title}
|
|
26
27
|
|
|
27
28
|
Generated by api-test-automation
|
|
28
|
-
Date: {datetime.now().strftime(
|
|
29
|
+
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
29
30
|
|
|
30
31
|
## Overview
|
|
31
32
|
{content}
|
|
@@ -56,10 +57,10 @@ api-test-automation
|
|
|
56
57
|
"category": "testing",
|
|
57
58
|
"plugin": "api-test-automation",
|
|
58
59
|
"data": data,
|
|
59
|
-
"config": self.config
|
|
60
|
+
"config": self.config,
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
with open(file_path,
|
|
63
|
+
with open(file_path, "w") as f:
|
|
63
64
|
json.dump(output_data, f, indent=2)
|
|
64
65
|
|
|
65
66
|
return file_path
|
|
@@ -71,7 +72,7 @@ api-test-automation
|
|
|
71
72
|
|
|
72
73
|
script_content = f"""#!/bin/bash
|
|
73
74
|
# Generated by api-test-automation
|
|
74
|
-
# Date: {datetime.now().strftime(
|
|
75
|
+
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
75
76
|
|
|
76
77
|
set -e # Exit on error
|
|
77
78
|
|
|
@@ -87,17 +88,20 @@ echo "✅ Completed successfully"
|
|
|
87
88
|
file_path.chmod(0o755) # Make executable
|
|
88
89
|
return file_path
|
|
89
90
|
|
|
91
|
+
|
|
90
92
|
def main():
|
|
91
|
-
parser = argparse.ArgumentParser(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
parser.add_argument(
|
|
95
|
-
parser.add_argument(
|
|
96
|
-
parser.add_argument(
|
|
93
|
+
parser = argparse.ArgumentParser(
|
|
94
|
+
description="Generates comprehensive test suites for REST and GraphQL APIs based on endpoint analysis and specifications."
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
|
|
97
|
+
parser.add_argument("--output", "-o", default="./output", help="Output directory")
|
|
98
|
+
parser.add_argument("--config", "-c", help="Configuration file")
|
|
99
|
+
parser.add_argument("--title", default="api-test-automation Output")
|
|
100
|
+
parser.add_argument("--content", help="Content to include")
|
|
97
101
|
|
|
98
102
|
args = parser.parse_args()
|
|
99
103
|
|
|
100
|
-
config = {
|
|
104
|
+
config = {"output": args.output}
|
|
101
105
|
if args.config and Path(args.config).exists():
|
|
102
106
|
with open(args.config) as f:
|
|
103
107
|
config.update(json.load(f))
|
|
@@ -106,24 +110,20 @@ def main():
|
|
|
106
110
|
|
|
107
111
|
print(f"🔧 Generating {args.type} output...")
|
|
108
112
|
|
|
109
|
-
if args.type ==
|
|
110
|
-
output_file = generator.generate_markdown(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
elif args.type == 'json':
|
|
115
|
-
output_file = generator.generate_json(
|
|
116
|
-
{"title": args.title, "content": args.content}
|
|
117
|
-
)
|
|
113
|
+
if args.type == "markdown":
|
|
114
|
+
output_file = generator.generate_markdown(args.title, args.content or "Generated content")
|
|
115
|
+
elif args.type == "json":
|
|
116
|
+
output_file = generator.generate_json({"title": args.title, "content": args.content})
|
|
118
117
|
else: # script
|
|
119
118
|
output_file = generator.generate_script(
|
|
120
|
-
args.title.lower().replace(
|
|
121
|
-
args.content or "# Add your script content here"
|
|
119
|
+
args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
|
|
122
120
|
)
|
|
123
121
|
|
|
124
122
|
print(f"✅ Generated: {output_file}")
|
|
125
123
|
return 0
|
|
126
124
|
|
|
125
|
+
|
|
127
126
|
if __name__ == "__main__":
|
|
128
127
|
import sys
|
|
128
|
+
|
|
129
129
|
sys.exit(main())
|