Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ TestGen AI – AI-Powered Test Case Generation Agent

Status Maintained Vercel Next.js React Node.js

TestGen AI is a state-of-the-art test case generator designed to create high-coverage test suites instantly. Utilizing the power of Google Gemini API, TestGen AI scans your source code, requirements specs, or API endpoints to construct standard, copy-paste ready assertions spanning multiple testing frameworks (Jest, Mocha, PyTest, Supertest, Cypress, Playwright, etc.).


⚑ Live Deployments


✨ Features

  • Unit Assertion Builder: Builds standard assertions verifying method behaviors, success states, and input checks.
  • Integration Pipelines: Simulates multi-step workflow logic covering databases, API routers, and services.
  • Vulnerability Scanner: Tests boundary validation checks, SQL Injection safety, cross-site scripting risks, and headers.
  • Edge Cases & Boundaries: Verifies empty payloads, zero limits, null pointer references, and extreme sizing.
  • Performance Benchmarking: Sets expectations for response latencies, payload throughput, and limits.
  • Dark Mode UI: Sleek, glassmorphism-based web interface built with Next.js, featuring glowing mesh gradients, progressive thinking sequences, and copyable results blocks.

πŸ› οΈ Technology Stack

Frontend

  • Core Framework: React 19 & Next.js 15 (App Router)
  • Styling: Tailwind CSS & Vanilla CSS transitions
  • Icons: Lucide React
  • Client Routing: Next.js App Router static optimization

Backend

  • Core Environment: Node.js (ES Modules)
  • Routing Framework: Express.js
  • AI Core: Google Gemini SDK (@google/generative-ai)
  • Security & Utilities: CORS, dotenv, nodemon

πŸ“ Repository Structure & Files

Here is the complete folder and file tree of the project:

.
β”œβ”€β”€ backend/                                # Node.js Express REST API server
β”‚   β”œβ”€β”€ controllers/                        # Handlers for API endpoints
β”‚   β”‚   └── generateController.js           # Receives prompts and manages generation responses
β”‚   β”œβ”€β”€ middleware/                         # Middleware interceptors
β”‚   β”‚   └── errorMiddleware.js              # Standard Express error handler
β”‚   β”œβ”€β”€ routes/                             # API path routes definitions
β”‚   β”‚   └── generateRoutes.js               # Route mapping for POST /api/generate
β”‚   β”œβ”€β”€ services/                           # Logic connecting to Google Gemini APIs
β”‚   β”‚   └── geminiService.js                # Core LLM processing and response schema mapping
β”‚   β”œβ”€β”€ utils/                              # Helper functions for the backend
β”‚   β”‚   └── promptBuilder.js                # Builds and formats structured system prompts
β”‚   β”œβ”€β”€ .env                                # Backend environment configuration variables
β”‚   β”œβ”€β”€ package.json                        # Backend package and script setup
β”‚   β”œβ”€β”€ server.js                           # Server boot entry point, CORS settings, health checks
β”‚   └── vercel.json                         # Serverless configuration rules for Vercel
β”‚
β”œβ”€β”€ frontend/                               # Next.js SPA Web Client
β”‚   β”œβ”€β”€ app/                                # App Router views and layouts
β”‚   β”‚   β”œβ”€β”€ favicon.ico                     # Next.js tab logo file
β”‚   β”‚   β”œβ”€β”€ globals.css                     # Global stylesheets, fonts, animations, layout styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx                      # Root App Router layout enclosing Navbar/Footer
β”‚   β”‚   β”œβ”€β”€ page.tsx                        # Main dashboard, templates grid, feature summaries
β”‚   β”‚   β”œβ”€β”€ privacy/                        # Privacy policy route
β”‚   β”‚   β”‚   └── page.tsx                    # Privacy Policy page details
β”‚   β”‚   └── terms/                          # Terms of Service route
β”‚   β”‚       └── page.tsx                    # Terms of Service page details
β”‚   β”œβ”€β”€ components/                         # Reusable UI component modules
β”‚   β”‚   β”œβ”€β”€ EmptyState.tsx                  # Component displayed when no tests are generated
β”‚   β”‚   β”œβ”€β”€ ExportButtons.tsx               # Handles PDF/JSON actions
β”‚   β”‚   β”œβ”€β”€ Footer.tsx                      # Custom footer with links and admin contact
β”‚   β”‚   β”œβ”€β”€ Hero.tsx                        # Mesh gradient header and floating title transitions
β”‚   β”‚   β”œβ”€β”€ InputArea.tsx                   # Prompt textarea area and form submit controls
β”‚   β”‚   β”œβ”€β”€ Loading.tsx                     # Progressive 0-99% thinking sequencer UI
β”‚   β”‚   β”œβ”€β”€ Navbar.tsx                      # Premium top navigation header
β”‚   β”‚   β”œβ”€β”€ OutputCard.tsx                  # Code viewer with syntax highlight and copy functionality
β”‚   β”‚   β”œβ”€β”€ ResultSection.tsx               # Outer boundary managing active output cards
β”‚   β”‚   β”œβ”€β”€ SampleTemplates.tsx             # Clickable grid examples for fast prompts loading
β”‚   β”‚   └── StatsSection.tsx                # Viewport count-up numbers displaying test statistics
β”‚   β”œβ”€β”€ hooks/                              # React custom state hooks
β”‚   β”‚   └── useGenerate.ts                  # Integrates frontend UI states with backend API calls
β”‚   β”œβ”€β”€ public/                             # Public static assets folder
β”‚   β”‚   └── logo.png                        # Main app branding logo image file
β”‚   β”œβ”€β”€ services/                           # API communication helpers
β”‚   β”‚   └── api.ts                          # Defines base fetch instances with fallback values
β”‚   β”œβ”€β”€ types/                              # TypeScript type interfaces definitions
β”‚   β”‚   └── testResult.ts                   # Typing interface for AI test suite outputs
β”‚   β”œβ”€β”€ utils/                              # Helper utilities
β”‚   β”‚   β”œβ”€β”€ copyText.ts                     # Handles secure clipboard copying
β”‚   β”‚   β”œβ”€β”€ downloadJson.ts                 # Triggers instant local file JSON downloads
β”‚   β”‚   └── exportPDF.ts                    # Dynamic PDF report builder
β”‚   β”œβ”€β”€ .env.local                          # Frontend local build environments configuration file
β”‚   β”œβ”€β”€ next-env.d.ts                       # Next.js TypeScript definitions compiler file
β”‚   β”œβ”€β”€ next.config.ts                      # Configuration rules for Next.js routing/headers
β”‚   β”œβ”€β”€ package.json                        # Frontend packages, TS types, next scripts configuration
β”‚   β”œβ”€β”€ postcss.config.mjs                  # PostCSS styling pipeline config file
β”‚   β”œβ”€β”€ tailwind.config.ts                  # Design tokens, custom themes, and core color setup
β”‚   └── tsconfig.json                       # TypeScript compiler strict mode settings
β”‚
β”œβ”€β”€ .gitignore                              # Defines version control ignored resources
└── README.md                               # Repository documentation guide

βš™οΈ Local Development Setup

Follow these steps to run the application locally on your computer.

Prerequisites

  • Node.js (v18 or higher)
  • npm package manager
  • A Google Gemini API Key (Get one from Google AI Studio)

Step 1: Configure & Start the Backend

  1. Navigate to the backend directory:
    cd backend
  2. Install the backend dependencies:
    npm install
  3. Create a .env file in the backend/ directory:
    PORT=5000
    GEMINI_API_KEY=your_gemini_api_key_here
    GEMINI_MODEL=gemini-1.5-flash
  4. Start the backend development server:
    npm run dev
    The backend will boot up on http://localhost:5000.

Step 2: Configure & Start the Frontend

  1. Navigate to the frontend directory:
    cd ../frontend
  2. Install the frontend dependencies:
    npm install
  3. Create a .env.local file in the frontend/ directory to configure endpoints:
    NEXT_PUBLIC_API_URL=http://localhost:5000
  4. Run the frontend development server:
    npm run dev
    Open http://localhost:3000 in your browser to view the TestGen AI dashboard.

πŸ”Œ API Documentation

1. Health Status

Check the status of the server.

  • Endpoint: GET /health
  • Response:
    {
      "status": "OK",
      "timestamp": "2026-05-25T08:52:00.000Z"
    }

2. Generate Test Suite

Send specifications/code and receive a fully generated, multi-category test suite.

  • Endpoint: POST /api/generate
  • Headers: Content-Type: application/json
  • Body:
    {
      "prompt": "Create an integration test suite for a node.js Express user register route that checks email validations and password hash storage."
    }
  • Response:
    {
      "unitTests": "...",
      "integrationTests": "...",
      "edgeCases": "...",
      "securityTests": "...",
      "performanceTests": "..."
    }

πŸ“ž Administrator & Contact Details

About

AI-powered test case generation platform that automatically creates unit, integration, security, performance, and edge-case test scenarios from source code, APIs, and requirements using Google Gemini AI.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages