Skip to content

Aaronrao989/Automated_Test_Case_Generator_Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Automated Test Case Generator Agent - Capgemini

Capgemini Exceller AgentifAI Buildathon Β· Team Osaka Vise

Live App API Docs License: MIT CI


🎯 Problem Statement

Teams lack sufficient tests, causing regressions. Build an agent that generates unit/integration test cases from code or user stories.

This agent analyzes source code repositories and code snippets to automatically generate, execute, and report on test cases β€” solving the test-coverage gap without manual effort.


✨ Features

Capability Description
πŸ€– AI Test Generation Groq LLM generates pytest-ready test cases from any Python code
πŸ” Edge Case Detection Identifies boundary conditions, null inputs, type errors, and more
πŸ“¦ Repository Analysis Scans entire repos or ZIP uploads and extracts all testable functions
▢️ Automatic Execution Runs generated tests via pytest and captures pass/fail results
πŸ“Š Coverage Reporting Computes and visualizes code coverage metrics
πŸ”„ CI Integration GitHub Actions pipeline for automated testing on every push
🌐 Interactive Dashboard Real-time job status, test viewer, and execution logs
🌍 Multi-language Detection Identifies languages and project structure automatically

πŸ—οΈ Architecture

Frontend (Next.js + Vercel)
        ↓
FastAPI Backend (Render)
        ↓
BackgroundTasks (async, no Celery/Redis)
        ↓
Groq LLM (llama-3.1-8b-instant)
        ↓
PostgreSQL (Render)

AI Pipeline

Input (Repo / Code Snippet)
        ↓
  Repository Scanner
        ↓
  Function Extraction
        ↓
  Edge Case Detection
        ↓
  LLM Test Generation
        ↓
    Pytest Execution
        ↓
  Coverage Analysis
        ↓
  Dashboard Reporting

πŸ› οΈ Tech Stack

Backend Β· FastAPI Β· SQLAlchemy Β· PostgreSQL Β· Groq API Β· Pytest Β· Python 3.11 Β· BackgroundTasks

Frontend Β· Next.js 16 Β· TypeScript Β· TailwindCSS Β· Lucide React

Deployment Β· Vercel (Frontend) Β· Render (Backend + PostgreSQL) Β· GitHub Actions (CI/CD)


πŸ“‘ API Reference

POST /api/v1/analysis/start

Start analysis on a code snippet or repository.

{
  "source_type": "code_snippet",
  "source_data": "def add(a, b): return a + b"
}

POST /api/v1/analysis/upload

Upload a ZIP archive of your repository for full project analysis.

GET /api/v1/analysis/{job_id}

Poll for results β€” returns generated tests, execution logs, and coverage metrics.

GET /health

Health check endpoint.


πŸ§ͺ Example Output

Given:

def divide(a, b):
    return a / b

The agent generates:

  • βœ… Happy path tests
  • βœ… Zero division tests
  • βœ… Invalid type tests
  • βœ… Boundary tests
  • βœ… Negative number tests

πŸ“‚ Project Structure

Automated_Test_Case_Generator_Agent/
β”œβ”€β”€ backend/
β”‚   └── app/
β”‚       β”œβ”€β”€ agents/
β”‚       β”‚   β”œβ”€β”€ orchestrator.py
β”‚       β”‚   β”œβ”€β”€ llm_test_generator.py
β”‚       β”‚   β”œβ”€β”€ edge_case_finder.py
β”‚       β”‚   β”œβ”€β”€ repo_scanner.py
β”‚       β”‚   β”œβ”€β”€ coverage.py
β”‚       β”‚   β”œβ”€β”€ test_executor.py
β”‚       β”‚   └── code_understanding.py
β”‚       β”œβ”€β”€ api/
β”‚       β”œβ”€β”€ core/
β”‚       β”œβ”€β”€ db/
β”‚       β”œβ”€β”€ models/
β”‚       β”œβ”€β”€ schemas/
β”‚       └── main.py
β”œβ”€β”€ frontend/
β”‚   └── src/app/
β”‚       β”œβ”€β”€ upload/
β”‚       β”œβ”€β”€ dashboard/
β”‚       β”œβ”€β”€ tests/
β”‚       └── page.tsx
└── .github/workflows/ci.yml

πŸš€ Local Setup

Backend

git clone https://github.com/Aaronrao989/Automated_Test_Case_Generator_Agent.git
cd Automated_Test_Case_Generator_Agent/backend

python -m venv venv
source venv/bin/activate       # Windows: venv\Scripts\activate

pip install -r requirements.txt
uvicorn app.main:app --reload
# β†’ http://localhost:8000

Frontend

cd ../frontend
npm install
npm run dev
# β†’ http://localhost:3000

Environment Variables

Backend (.env):

DATABASE_URL=postgresql://...
GROQ_API_KEY=your_groq_key
LLM_PROVIDER=groq
GROQ_MODEL=llama-3.1-8b-instant

Frontend (.env.local):

NEXT_PUBLIC_API_URL=https://automated-test-case-generator-agent.onrender.com

πŸ”„ CI/CD

GitHub Actions runs on every push:

  • Backend test suite (pytest tests/ -v)
  • Frontend lint + build verification
  • Coverage checks

πŸ“ˆ Evaluation Criteria β€” How We Address Each

Criterion Implementation
Test relevance & coverage LLM generates context-aware tests with pytest fixtures and assertions
Correctness Tests are executed automatically; only passing tests surface in reports
Edge case handling Dedicated edge_case_finder.py agent identifies boundary and failure conditions
Maintainability Generated tests follow pytest conventions with clear naming and docstrings
CI integration GitHub Actions workflow included; API-first design supports any CI tool

πŸ›£οΈ Roadmap

  • Advanced coverage heatmaps
  • Multi-file dependency analysis
  • Java & Go execution support
  • Mutation testing
  • Real-time streaming updates
  • Authentication & team workspaces
  • Persistent history dashboard

πŸ‘₯ Team β€” Osaka Vise

Name Role
Aaron Rao AI Testing & Validation
Aditi Karn System Architecture Lead
Aryan Gupta UI/UX Developer
Nitin Chugh Backend & API Engineer
Vidushi Srivastava Presentation Lead

πŸ“„ License

MIT Β© Team Osaka Vise β€” Built for the Capgemini Exceller AgentifAI Buildathon

About

AI-powered automated test case generator with repository analysis, edge-case detection, pytest execution, and coverage reporting using FastAPI, Groq LLM, and Next.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors