AI-powered API testing & documentation generator with OpenAPI/Swagger support
An AI-powered CLI tool that automatically generates Postman collections, API documentation, test files, and live endpoint testing from your backend codebase.
- ๐ Route Scanning - Automatically discovers all API routes from TypeScript files
- ๐งช Live Endpoint Testing - Makes REAL HTTP requests and records actual responses
- ๐ Auth Detection - Automatically detects login endpoints and manages JWT tokens
- ๐ Schema Detection - Finds Zod, Joi, and class-validator schemas
- ๐ Postman Collections - Generates organized collections with example responses
- ๐ Environment Files - Creates local & production Postman environments
- ๐งช Test Generation - Generates Bun test files for all routes
- ๐ OpenAPI/Swagger - Generates OpenAPI 3.0 spec with interactive Swagger UI
- ๐ Enhanced Documentation - Creates comprehensive markdown API docs
- ๐ Test Reports - Saves detailed live test results in JSON format
``bash`
cd /Users/devx/Desktop/AITESTING
bun link
Now use aitesting command from anywhere!
`bash`
cd /Users/devx/Desktop/AITESTING
bun install
`bash`
aitesting --path /path/to/your/backend
`bash`
aitesting --path /path/to/your/backend --all
`bash`
aitesting --path /path/to/backend --all --url https://api.yourapp.com
`bash`
aitesting --path /backend --all -o ~/Documents/api-docs
The --all flag runs the complete workflow:
1. โ
Scans backend for routes
2. โ
Detects authentication endpoints
3. โ
Finds validation schemas
4. โ
Tests all endpoints live
5. โ
Captures JWT tokens automatically
6. โ
Generates Postman collection with example responses
7. โ
Creates environment files
8. โ
Generates automated test files
9. โ
Creates enhanced documentation
When you run with --all, you'll get:
``
๐ Project Root
โโโ postman_collection.json # Postman collection with examples
โโโ local_environment.postman_environment.json
โโโ production_environment.postman_environment.json
โโโ openapi.json # OpenAPI 3.0 specification
โโโ api-docs.html # Swagger UI (open in browser!)
โโโ API_DOCUMENTATION.md # Markdown API docs
โโโ .aitesting/
โ โโโ report.json # Live test results
โโโ tests/auto/
โโโ users.test.ts # Auto-generated tests
โโโ auth.test.ts
โโโ ...
Scans your TypeScript files using AST parsing to find all route definitions:
`typescript`
router.get("/users/:id", handler);
router.post("/auth/login", handler);
โ ๏ธ Makes actual HTTP requests to your backend:
- Tests each endpoint with real network calls (using fetch)
- Records actual response status codes
- Captures real response bodies
- Saves headers and error messages
- Requires your backend to be running!
- Automatically detects login/auth endpoints
- Obtains JWT tokens during testing
- Injects tokens into subsequent requests
- Adds auth headers to Postman collection
Finds validation schemas in your code:
- Zod schemas (z.object(...))Joi.object(...)
- Joi schemas ()@IsString()
- class-validator decorators (, etc.)
Creates ready-to-run Bun tests:
`typescript
import { test, expect, describe } from "bun:test";
describe("Users Routes", () => {
test("GET /users/:id", async () => {
const response = await fetch(${baseUrl}/users/1);`
expect(response).toBeDefined();
});
});
Generates industry-standard OpenAPI 3.0 specification:
- openapi.json - Complete OpenAPI 3.0 spec
- api-docs.html - Interactive Swagger UI
- Includes auth schemes, request/response examples
- Path parameters, request bodies, responses
- Open api-docs.html in browser for interactive docs!
The tool works out-of-the-box, but you can customize:
- Base URL: Edit the baseUrl in generated environment filestoken
- Auth Token Detection: Supports , access_token, and accessToken fieldsrouter.*
- Route Detection: Looks for patterns in TypeScript files
- Bun runtime
- Backend with TypeScript route definitions
- Routes using router.get(), router.post(), etc. pattern
`
๐ AITesting v1.0 - Full Workflow
๐ Scanning backend in: ./backend
โ
Found 23 routes
๐ Detected auth endpoint: POST /auth/login
๐ Detected schemas: zod, class-validator
๐งช Running live endpoint tests...
โ
Auth token obtained
โ GET /users 200
โ POST /users 201
โ GET /users/:id 200
โ DELETE /users/:id 401
๐ Live test report saved to .aitesting/report.json
๐ Generated: postman_collection.json
๐ Environments generated (local & production)
๐งช Test files generated in tests/auto/
๐ Enhanced documentation generated (API_DOCUMENTATION.md)
โ
Complete! All features executed successfully.
`
- โ ๏ธ Requires your backend to be running at http://localhost:5000 (default)fetch()
- Makes REAL HTTP requests using - not mock/sample data!:id
- Path parameters (e.g., ) are replaced with 1 during testingopenapi.json
- Failed tests are recorded in the report but don't stop the workflow
- Responses in and Postman collection are actual responses from your API
- Open api-docs.html` in any browser for interactive documentation
- Works offline - Swagger UI loads from CDN
- Can be hosted on any web server for team sharing
This is a productivity tool. Feel free to extend and customize for your needs!
See LICENSE file.