opentest.live
v1.1.0
Published
AI-powered API testing CLI that analyzes your codebase, discovers routes, handles OTP verification, and generates intelligent test cases automatically
Maintainers
Readme
OpenTest.live CLI
AI-powered API testing that analyzes your codebase, discovers routes, infers schemas, and generates intelligent test cases automatically.
🚀 Quick Start
Run this one command in your API project directory:
npx opentest.live launchThat's it! The CLI will:
- ✅ Analyze your codebase and discover all API routes
- ✅ Infer request/response schemas with high accuracy
- ✅ Open https://opentest.live in your browser
- ✅ Import all endpoints to your workspace
- ✅ Watch for code changes in real-time
📦 Installation
Option 1: Use with npx (Recommended)
No installation needed:
cd /path/to/your-api-project
npx opentest.live launchOption 2: Global Installation
npm install -g opentest.live
opentest launch✨ Features
🔍 Intelligent Route Discovery
- Automatically scans your codebase for API endpoints
- Supports Express, Fastify, Koa, Hapi, and more
- Detects route prefixes from
server.jsmounting - Discovers both controller-based and inline handlers
🧠 Smart Schema Inference
Extracts schemas with confidence scoring (0-1.0):
- Zod validators (0.95 confidence) -
z.object({ ... }) - Joi validators (0.9 confidence) -
Joi.object({ ... }) - express-validator (0.9 confidence) -
body('email').isEmail() - Code analysis (0.6 confidence) - Infers from
req.bodyusage - Heuristics (0.5 confidence) - Common auth patterns only
Features:
- ✅ Follows imports across files (resolves
import { schema } from './validators') - ✅ Detects multipart/form-data (file uploads)
- ✅ Infers response shapes from
res.json()calls - ✅ Parses inline route handlers
- ✅ Fails closed (returns
nullinstead of inventing fields)
🔐 Authentication Detection
- Auto-discovers login, signup, OTP verification endpoints
- Marks protected routes requiring authentication
- Generates auth headers in cURL commands
📡 Real-Time Sync
- Watches your codebase for changes
- Auto-updates the web dashboard when routes/schemas change
- No manual re-import needed
🎨 Beautiful cURL Generation
# JSON endpoint
curl -X POST https://api.example.com/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"your_password"}'
# File upload (auto-detected)
curl -X POST https://api.example.com/upload \
-F "file=@/path/to/file" \
-F "description=My upload"📚 Usage Examples
Basic Usage (Current Directory)
npx opentest.live launchAnalyze Specific Directory
npx opentest.live launch --dir ./backendVerbose Logging (Debug)
npx opentest.live launch --verboseLocal Development (Custom URLs)
npx opentest.live launch \
--backend http://localhost:2003 \
--frontend http://localhost:3002🎯 How It Works
1. Codebase Analysis (2-5 seconds)
The CLI scans your project:
- Parses
server.jsto find route mounting points - Discovers route files (
*Routes.js,*Controller.js) - Extracts HTTP methods, paths, handlers
2. Schema Extraction
For each route, the CLI:
- Checks for Zod/Joi/express-validator schemas
- Follows imports to find schema definitions
- Parses controller code for
req.bodyusage - Infers response shapes from
res.json()calls - Assigns confidence score based on extraction method
3. Browser Launch & Auth
- Opens
https://opentest.live/launch?session=<id> - You login/signup on the web interface
- Your workspace ID is sent to the CLI automatically
4. Import & Sync
- All discovered endpoints imported to your workspace
- Each endpoint includes:
- HTTP method, path, description
- Request schema (params, query, body, headers)
- Response schema
- cURL example
- Confidence score and schema source
- CLI watches for file changes and syncs updates
📊 Schema Confidence Levels
Each endpoint includes metadata:
{
"path": "/api/v1/users",
"method": "POST",
"requestSchema": { "body": { ... } },
"meta": {
"source": "zod",
"confidence": 0.95
}
}Confidence Guide
| Confidence | Source | Meaning |
|------------|--------|---------|
| 0.95-1.0 | zod, joi | ✅ Explicit validator - highly accurate |
| 0.9 | express-validator | ✅ Validator chain - very accurate |
| 0.6-0.8 | body-reads, inline-handler | ⚠️ Inferred from code - good accuracy |
| 0.5-0.59 | heuristic | ℹ️ Pattern-based - auth endpoints only |
🛠️ Supported Frameworks
- ✅ Express.js (fully supported)
- ✅ Fastify (supported)
- ✅ Koa (supported)
- ✅ Hapi (supported)
- 🚧 NestJS (coming soon)
- 🚧 Next.js API Routes (coming soon)
🔧 Configuration
CLI Options
| Option | Description | Default |
|--------|-------------|---------|
| -d, --dir <directory> | Directory to analyze | Current directory |
| -b, --backend <url> | Backend API URL | https://flux-backend-production-ca39.up.railway.app |
| -f, --frontend <url> | Frontend URL | https://opentest.live |
| -v, --verbose | Enable verbose logging | false |
Environment Variables
# Override default URLs
export OPENTEST_BACKEND_URL=https://flux-backend-production-ca39.up.railway.app
export OPENTEST_FRONTEND_URL=https://opentest.live📖 Documentation
- Production Usage Guide - Detailed production setup
- Architecture - How it works under the hood
- Contributing - How to contribute
🐛 Troubleshooting
"Session not found"
Cause: Session expired (5 minute timeout)
Solution: Run npx opentest.live launch again
"No routes found"
Cause: CLI couldn't find route definitions
Solution:
- Ensure you're in the project root directory
- Check that route files follow naming conventions (
*Routes.js,*Controller.js) - Use
--verboseto see what files are being scanned
Browser doesn't open
Cause: System couldn't launch default browser
Solution: Copy/paste the URL from the terminal
Low schema confidence
Cause: No explicit validators found
Solution: Add Zod, Joi, or express-validator to your routes for higher accuracy
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
📝 License
MIT © OpenTest.live
🙏 Acknowledgments
Built with:
- Commander.js - CLI framework
- Acorn - JavaScript parser
- Chokidar - File watcher
- Chalk - Terminal styling
- Ora - Elegant spinners
📧 Support
- Website: https://opentest.live
- Email: [email protected]
- GitHub: https://github.com/your-org/opentest-cli/issues
- Twitter: @OpenTestLive
Made with ❤️ by the OpenTest.live team
