--- tags: - ai-testing - test-generation - multi-agent ---
# ๐Ÿงช TestGenius AI ### AI Test Case Generation Agent for QA Teams **Multi-Agent Iterative Refinement โ€ข Behavior Coverage Mapping โ€ข Mutation-Guided Testing** [![Production Ready](https://img.shields.io/badge/status-production--ready-brightgreen)]() [![Research Grade](https://img.shields.io/badge/novelty-research--grade-purple)]() [![Universal LLM](https://img.shields.io/badge/LLM-any_provider-orange)]() *Not just another GPT wrapper. A 5-agent pipeline that generates, validates, and iteratively* *improves tests using mutation testing feedback โ€” inspired by MuTAP (ISSTA 2023).*
--- ## ๐ŸŽฏ Problem > *"Writing comprehensive test cases manually is time-consuming and often misses edge cases."* QA teams spend 40-60% of their time writing tests. They miss edge cases, security vulnerabilities, and integration failures. Existing AI tools (Copilot, basic GPT wrappers) do single-shot generation with no validation โ€” producing tests that look good but don't catch real bugs. **TestGenius AI is different.** It doesn't just generate โ€” it **analyzes, generates, validates, refines iteratively, and maps behavior coverage**. --- ## ๐Ÿง  Research-Grade Architecture (The Key Differentiator) Inspired by: **MuTAP** (arxiv:2308.16557, ISSTA 2023) + **HITS** (ASE 2024) + **Code Agents** (arxiv:2406.12952) ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ TESTGENIUS MULTI-AGENT PIPELINE โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ โ”‚ INPUT (code/requirements/API spec) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ AGENT 1: ANALYZER โ”‚ โ”‚ โ”‚ โ”‚ โ€ข AST-based complexity scoring โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Behavior extraction (testable behaviors) โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Coverage gap detection โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Function prioritization (complex = more tests) โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ AGENT 2: GENERATOR โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Context-rich structured prompt โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Behavior-guided generation (tests PER behavior) โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Framework-specific (pytest/Jest/Cypress) โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ AGENT 3: VALIDATOR โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Quality scoring (5 dimensions, A-D grade) โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Assertion density check โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Edge case coverage measurement โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Identifies WHAT'S WEAK in the tests โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ AGENT 4: REFINER (MuTAP-inspired loop) โ”‚ โ† ITERATES โ”‚ โ”‚ โ”‚ โ€ข Identifies surviving mutations โ”‚ until โ”‚ โ”‚ โ”‚ โ€ข Re-prompts LLM with mutation feedback โ”‚ quality โ‰ฅ B โ”‚ โ”‚ โ”‚ โ€ข Strengthens weak tests automatically โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Adds tests that KILL surviving mutants โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ AGENT 5: COVERAGE MAPPER โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Maps tests โ†’ behaviors (which ARE tested) โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Shows UNTESTED behaviors (red flags) โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Coverage % by category (happy/edge/error/security) โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ OUTPUT: Tests + Quality Grade + Behavior Coverage Map โ”‚ โ”‚ + Refinement History + Untested Behavior Warnings โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` **Why this beats every other hackathon submission:** - Single-shot generators (Copilot, GPT wrappers): Generate once, no validation โ†’ produce tests that miss bugs - TestGenius: Generate โ†’ Score โ†’ Identify weaknesses โ†’ Re-generate stronger tests โ†’ Verify coverage --- ## โœจ 8 Novelty Features | # | Feature | Research Basis | What It Does | |---|---------|---------------|--------------| | 1 | ๐Ÿ”„ **Iterative Refinement** | MuTAP (ISSTA'23) | Tests improve across iterations using mutation feedback | | 2 | ๐Ÿ“Š **Behavior Coverage** | Qodo/CodiumAI concept | Maps WHICH behaviors are tested vs untested | | 3 | ๐Ÿงฌ **Mutation-Guided Testing** | MuTAP + EvoSuite | Identifies test gaps where mutations would survive | | 4 | ๐Ÿง  **Code Complexity Analysis** | McCabe (1976) | AST-based cyclomatic complexity โ†’ prioritizes testing | | 5 | ๐Ÿ” **Coverage Gap Detection** | Static analysis | Finds untested error paths, branches, external calls | | 6 | ๐Ÿ“ˆ **Test Quality Scoring** | Test smell research | Grades tests A-D on 5 dimensions | | 7 | ๐Ÿ” **API Security Scanner** | OWASP Top 10 | Detects injection points, missing auth, path traversal | | 8 | ๐Ÿค– **Multi-Agent Architecture** | Code Agents (arxiv:2406.12952) | 5 specialized agents, not one monolithic prompt | --- ## ๐Ÿš€ Quick Start ```bash # Backend cd backend pip install -r requirements.txt cp .env.example .env # Set LLM_BASE_URL, LLM_API_KEY, LLM_MODEL uvicorn app.main:app --reload --port 8000 # Frontend cd frontend npm install && npm run dev # โ†’ http://localhost:5173 ``` ### Docker (Full Stack) ```bash cp backend/.env.example backend/.env # Set your LLM API key docker-compose up -d # โ†’ Backend: http://localhost:8000/docs # โ†’ Frontend: http://localhost:3000 ``` ### Custom LLM (.env) ```env # Works with ANY OpenAI-compatible API: LLM_BASE_URL=https://api.groq.com/openai/v1 LLM_API_KEY=gsk_your_key LLM_MODEL=llama-3.3-70b-versatile ``` Supports: Groq, Featherless, OpenAI, Together, DeepSeek, OpenRouter, Mistral, Ollama, LM Studio --- ## ๐Ÿ“ก API Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | POST | `/api/v1/generate/from-requirements` | Generate from product requirements | | POST | `/api/v1/generate/from-api-spec` | Generate from OpenAPI/Swagger | | POST | `/api/v1/generate/from-code` | Generate unit tests from source code | | POST | `/api/v1/generate/from-flow` | Generate E2E tests from user flow | | POST | `/api/v1/generate/unified` | All inputs โ†’ full test suite | | POST | **`/api/v1/generate/multi-agent`** | **๐Ÿง  Multi-agent iterative pipeline** | | POST | `/api/v1/generate/multi-agent/stream` | Streaming SSE pipeline | | POST | `/api/v1/analyze/behaviors` | Extract testable behaviors | | POST | `/api/v1/analyze/complexity` | AST complexity analysis | | POST | `/api/v1/analyze/security` | OWASP API security scan | | POST | `/api/v1/analyze/mutations` | Identify mutation points | | POST | `/api/v1/analyze/mutations/execute` | ๐Ÿงฌ Run real mutation testing | | POST | `/api/v1/analyze/quality` | Score test quality (A-D) | | POST | `/api/v1/analyze/gaps` | Coverage gap detection | | GET | `/api/v1/usage` | Token usage & cost tracking | | GET | `/api/v1/frameworks` | Supported frameworks | | GET | `/api/v1/provider` | Current LLM provider info | | GET | `/health` | System health + capabilities | --- ## ๐Ÿ“Š Multi-Agent Response (Example) ```json { "run_id": "MAS-a7f3b2c9", "pipeline": "multi-agent-iterative-v2", "quality": { "overall": 82, "grade": "A", "scores": {"assertions": 8, "edge_cases": 7, "error_handling": 9, "isolation": 8, "docs": 6} }, "syntax_validation": {"valid": true, "test_count": 18, "has_assertions": true}, "behavior_coverage": { "total_behaviors": 18, "covered": 15, "uncovered": 3, "coverage_pct": 83.3 }, "mutation_testing": { "total_mutants": 12, "killed": 9, "survived": 3, "mutation_score": 75.0 }, "iterations_performed": 2, "processing_time_ms": 4200 } ``` --- ## ๐Ÿ“ Project Structure ``` testgenius-ai/ โ”œโ”€โ”€ backend/ โ”‚ โ”œโ”€โ”€ app/ โ”‚ โ”‚ โ”œโ”€โ”€ main.py โ”‚ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ generate.py # Standard generation endpoints โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ multi_agent_routes.py # ๐Ÿง  Multi-agent + analysis endpoints โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ frameworks.py โ”‚ โ”‚ โ””โ”€โ”€ services/ โ”‚ โ”‚ โ”œโ”€โ”€ llm_provider.py # Universal LLM (any provider) โ”‚ โ”‚ โ”œโ”€โ”€ test_generator.py # Core generation logic โ”‚ โ”‚ โ”œโ”€โ”€ prompt_builder.py # Structured prompts โ”‚ โ”‚ โ”œโ”€โ”€ multi_agent_engine.py # ๐Ÿง  5-agent iterative pipeline โ”‚ โ”‚ โ””โ”€โ”€ novelty_features.py # Complexity, mutations, security โ”‚ โ”œโ”€โ”€ tests/ # Pytest test suite โ”‚ โ”œโ”€โ”€ Dockerfile โ”‚ โ”œโ”€โ”€ requirements.txt โ”‚ โ””โ”€โ”€ .env.example โ”œโ”€โ”€ frontend/ โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx # Router + Error Boundary โ”‚ โ”‚ โ””โ”€โ”€ pages/ โ”‚ โ”‚ โ”œโ”€โ”€ LandingPage.tsx # Hero + features โ”‚ โ”‚ โ”œโ”€โ”€ GeneratePage.tsx # Multi-tab input + output โ”‚ โ”‚ โ”œโ”€โ”€ AnalyzePage.tsx # Deep code analysis โ”‚ โ”‚ โ””โ”€โ”€ HistoryPage.tsx # Previous generations โ”‚ โ”œโ”€โ”€ Dockerfile โ”‚ โ””โ”€โ”€ package.json โ”œโ”€โ”€ docker-compose.yml โ””โ”€โ”€ README.md ``` --- ## ๐Ÿ† Why This Wins the Hackathon | What Judges Look For | What We Deliver | |---------------------|-----------------| | **Creativity** | Multi-agent iterative refinement (no other team has this) | | **Technical depth** | AST parsing, real mutation execution, OWASP scanning, behavior mapping | | **AI integration** | Not "call GPT and return" โ€” 5-agent pipeline with feedback loops | | **Real-world usability** | Paste code โ†’ get production-ready tests in 3 seconds | | **Research backing** | Cites MuTAP (ISSTA'23), HITS (ASE'24), Code Agents (2406.12952) | | **Production quality** | FastAPI + Docker + Pydantic + universal LLM + pytest suite | ### What Makes This UNIQUE vs Every Other Submission: > **"Other teams will call an LLM once and return whatever it outputs. We call it, VALIDATE the output, identify weaknesses using mutation analysis, then ITERATIVELY IMPROVE until quality reaches grade A โ€” exactly like the MuTAP paper from ISSTA 2023. That's not a wrapper โ€” that's a research-grade AI agent."** --- ## ๐Ÿงช Running Tests ```bash cd backend pip install -r requirements.txt pytest tests/ -v ``` --- ## ๐Ÿ“„ License MIT ---
**TestGenius AI โ€” Not just generating tests. Generating BETTER tests, iteratively.** *Research-grade quality. Production-ready deployment. Hackathon-winning novelty.*