CaptAIn-Q TestGenerator
Learn AI-Powered API Test Generation
An educational demonstration project that shows how to build an intelligent test case generation system using Retrieval-Augmented Generation (RAG) combined with Model Context Protocol (MCP).
What Is CaptAIn-Q?
CaptAIn-Q is an educational demonstration project that shows how to build an intelligent system that automatically generates API and UI test cases using Retrieval-Augmented Generation (RAG) combined with the Model Context Protocol (MCP).
Learning Objectives
Technical Architecture
The system comprises three core components working together:
RAG Service (Python/FastAPI)
- β’Ingests documentation from OpenAPI specs, wikis, business documents, and UI specifications
- β’Creates vector embeddings using deterministic "fake embeddings" based on character frequency and hashing
- β’Performs cosine similarity searches to locate relevant documentation
- β’Generates canonical test definitions in JSON format
- β’Implements structured logging with correlation IDs for request tracing
MCP Server (TypeScript/Node.js)
- β’Provides tool layer for AI assistant integration (ChatGPT, Claude Desktop)
- β’Parses OpenAPI specifications
- β’Converts test definitions to multiple formats (Postman collections, RestAssured Java tests)
- β’Acts as HTTP client communicating with the RAG service
Data Sources
βοΈ How It Works Behind the Scenes
MCP Integration
You interact with ChatGPT or Claude Desktop (requires your own subscription). The MCP server connects your AI assistant to the RAG service through the Model Context Protocol.
Natural Language Query
Ask "generate tests for POST /login" in your AI assistant. The MCP server receives this request and forwards it to the RAG service.
Vector Similarity Search
The RAG service uses deterministic embeddings (character frequency + hashing) to find relevant documentation via cosine similarityβno external LLM API calls needed for embeddings!
Test Generation
Based on the retrieved documentation, the system generates test cases across five profiles: Smoke, Functional, Regression, Security, and Bugfix.
Multi-Format Export
Tests are returned in your chosen format: canonical JSON, Postman collections, or RestAssured Java codeβready to use in your testing workflow.
π― Five Test Profiles
Smoke
Happy path scenarios only
Functional
Positive and negative test cases
Regression
Comprehensive edge cases
Security
Authentication and injection tests
Bugfix
Targeted verification tests
β Key Differentiators
π§ Deterministic Embeddings
Uses character frequency and hashing instead of external embedding servicesβmaking it entirely self-contained with no embedding API costs
π MCP Protocol
Leverages Model Context Protocol to integrate with AI assistants like ChatGPT and Claude Desktop
π Multi-Format Export
Exports to industry-standard formats (Postman, RestAssured) while maintaining a canonical test definition layer
π³ Docker-Based
Fully containerized with Docker Compose for easy setup and deployment
π Requirements
- βDocker and Docker Compose for containerization
- β4GB+ RAM for running the services
- βPorts 8000 and 3000 available on your system
- βChatGPT Plus or Claude subscription (bring your own) to use with MCP
π Educational Resources
Learn Automated Testing Blog
Explore in-depth articles, tutorials, and guides on AI-powered test generation, RAG patterns, MCP integration, and more through our educational blog.
Visit Educational BlogEducational Services
Get hands-on training, workshops, and personalized guidance on implementing AI test automation in your projects through our educational services.
Explore ServicesReady to Learn AI Test Generation?
This educational project teaches you how to build intelligent test automation systems using RAG and MCP.