A web application that analyzes source code and automatically generates test case scenarios and full unit test code using Google's Gemini API. Built with React (frontend) and Express.js (backend), and deployed on Render.
Developed as part of an internship assignment, with additional enhancements for production readiness.
- Upload multiple code files.
- AI-powered test case summaries.
- Generate full unit test code in:
- JUnit (Java)
- PyTest (Python)
- Jest (JavaScript)
- NUnit (C#)
- One-click GitHub PR creation with generated tests.
- Frontend: React, Tailwind CSS
- Backend: Node.js, Express.js, Google Generative AI SDK
- Hosting: Render
- Version Control: Git + GitHub
testcase_generator/
│
├── assets/ # Screenshots for README
├── frontend/ # React app
├── backend/ # Express.js server
├── Sample/ # Sample codes to generate test cases
└── README.md
git clone https://github.com/aryanpratik11/testcase_generator.git
cd testcase_generator
cd backend
npm install
Create a .env
file:
PORT=5000 #or any port of your choice
GEMINI_API_KEY=your_api_key_here
Run the backend:
node index.js
cd ../frontend
npm install
npm start
Method | Endpoint | Description |
---|---|---|
POST | /api/generate |
Generates test case summaries from code |
POST | /api/generateCode |
Generates full unit test code |
POST | /api/create-pr |
Creates a GitHub PR with generated tests |
- Frontend: Hosted on Render, connected to
main
branch. - Backend: Hosted on Render, with
.env
set via Render's Environment settings.
Contributions are welcome!
- Fork the repo
- Create your branch (
git checkout -b branch_name
) - Commit changes (
git commit -m "Exact feature you are implementing"
) - Push to branch (
git push origin branch_name
) - Open a Pull Request
Extra features like allowing test cases editing before PR creation or any such features are invited.