An intelligent developer tool that automatically generates unit tests for your code using Large Language Models (LLMs). This project helps engineers save time, improve code quality, and ensure better test coverage with minimal manual effort.
test-pilot-demo.mp4
AI Test Generator analyzes source code and produces high-quality unit tests (e.g., Jest) covering:
- Normal use cases
- Edge cases
- Error handling scenarios
It integrates with GitHub workflows to automatically create Pull Requests with generated tests — enabling seamless CI/CD integration.
- LLM-powered test generation (Gemini / OpenAI / Claude compatible)
- Real-time test generation via WebSocket
- Auto Pull Request creation
- Docker-based execution environment
- Supports multiple code inputs dynamically
- Structured and clean test output (Jest-ready)
- Secure repo interaction using GitHub APIs
- Next.js (TypeScript)
- WebSockets for real-time updates
- Tailwind / ShadCN UI
- Node.js (Express / Hono)
- WebSocket Server
- LLM Integration (Gemini / OpenAI / Claude)
- Docker (isolated test execution)
- GitHub API (Repo fork + PR automation)
-
User submits code via UI
-
Backend sends code to LLM with structured prompt
-
LLM generates unit tests
-
Tests are parsed and validated
-
Repo is:
- Forked
- Updated with tests
- PR is automatically created
The system uses a structured prompt like:
You are a senior software engineer.
Write Jest unit tests for the following code.
Include:
- normal cases
- edge cases
- proper assertions
Return ONLY valid Jest test code.
├── frontend/ # Next.js app
├── backend/
│ ├── websocket/ # WebSocket server
│ ├── llm/ # LLM integration
│ ├── parser/ # JSON/test extraction logic
│ └── github/ # PR + repo automation
├── docker/ # Execution environment
└── README.md
git clone https://github.com/your-username/ai-test-generator.git
cd ai-test-generator
cd backend
bun install
cd ../frontend
npm install
Create .env files:
GITHUB_TOKEN=your_token
LLM_API_KEY=your_key
Backend:
bun src/index.ts
Frontend:
npm run dev
-
Client connects to WebSocket server
-
Sends code payload
-
Receives:
- Status updates
- Generated test cases
- Errors (if any)
- Runs test execution in an isolated container
- Prevents infinite loops / unsafe code execution
- Ensures reproducibility
- Automatically forks the repository
- Adds generated test files
- Commits changes
- Creates a Pull Request
This enables developers to review and merge AI-generated tests easily.
describe("sum function", () => {
test("adds two numbers", () => {
expect(sum(2, 3)).toBe(5);
});
test("handles negative numbers", () => {
expect(sum(-1, -1)).toBe(-2);
});
});- Multi-language support (Python, Go, Java)
- Code coverage visualization
- Inline test suggestions in editor (VSCode extension)
- Fine-tuned model for better accuracy
- Retry + feedback loop for failed tests
Contributions are welcome!
- Fork the repo
- Create a new branch
- Make changes
- Submit a PR
MIT License
- OpenAI / Google Gemini / Anthropic
- GitHub API
- Docker
Ayush Kannaujiya
- Full Stack Engineer
- Passionate about AI + Developer Tools
If you like this project, give it a star on GitHub!