A comprehensive web application that automatically generates test cases for your GitHub repositories using AI. Built with React, Node.js, and multiple AI providers.
- OAuth Authentication: Secure login with GitHub
- Repository Listing: Browse all your GitHub repositories
- File Selection: Choose specific source code files for testing
- Pull Request Creation: Automatically create PRs with generated tests
- Multiple AI Providers: Support for OpenAI, Gemini, and Ollama
- Smart Analysis: AI analyzes your code and suggests test scenarios
- Framework Detection: Automatically recommends appropriate testing frameworks
- Comprehensive Coverage: Generates unit tests, integration tests, and edge cases
- JavaScript/TypeScript: Jest, Mocha, Vitest
- Python: Pytest, Unittest, Nose
- Java: JUnit, TestNG
- C++: Google Test, Catch2
- C#: NUnit, xUnit, MSTest
- PHP: PHPUnit, Codeception
- Ruby: RSpec, Minitest
- Go: Testing, Testify
- Rust: Cargo Test
- And more...
- Responsive Design: Works on desktop and mobile
- Real-time Feedback: Loading states and progress indicators
- Code Highlighting: Syntax-highlighted test code display
- Copy/Download: Easy export of generated tests
- Node.js 18+
- npm or yarn
- GitHub account
- AI API key (OpenAI, Gemini, or Ollama)
git clone <repository-url>
cd test-case-generatorcd backend
npm install
cp env.example .envEdit .env with your configuration:
# Server Configuration
PORT=5000
NODE_ENV=development
# GitHub OAuth (Required)
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:5000/auth/github/callback
# Session Configuration
SESSION_SECRET=your_session_secret_key_here
# AI API Configuration (Choose one)
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-3.5-turbo
# OR Gemini
GEMINI_API_KEY=your_gemini_api_key
# OR Ollama (for local AI)
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=codellama
# CORS Configuration
FRONTEND_URL=http://localhost:5173cd ../frontend
npm install
cp env.example .envEdit frontend .env:
VITE_API_URL=http://localhost:5000/api# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm run devVisit http://localhost:5173 to use the application!
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Fill in the details:
- Application name: Test Case Generator
- Homepage URL:
http://localhost:5173 - Authorization callback URL:
http://localhost:5000/auth/github/callback
- Copy the Client ID and Client Secret to your
.envfile
- Get an API key from OpenAI Platform
- Add to
.env:OPENAI_API_KEY=your_key_here
- Get an API key from Google AI Studio
- Add to
.env:GEMINI_API_KEY=your_key_here
- Install Ollama
- Run:
ollama pull codellama - Add to
.env:OLLAMA_BASE_URL=http://localhost:11434
- Click "Login with GitHub" on the homepage
- Authorize the application to access your repositories
- Browse your GitHub repositories
- Click on a repository to view its source files
- Select one or more source code files
- Click "Generate Tests" to proceed
- Review AI-generated test summaries
- Click "Generate Test Code" for any summary
- Copy, download, or create a pull request with the tests
- Click "Create PR" on generated test code
- Customize PR title, description, and branch name
- Submit to create a pull request in your repository
test-case-generator/
├── frontend/ # React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── contexts/ # React contexts
│ │ └── App.jsx # Main app component
│ └── package.json
├── backend/ # Node.js/Express server
│ ├── src/
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Express middleware
│ │ ├── config/ # Configuration
│ │ └── server.js # Main server file
│ └── package.json
└── README.md
GET /api/auth/login- GitHub OAuth loginGET /api/auth/callback- OAuth callbackGET /api/auth/logout- LogoutGET /api/auth/status- Check auth status
GET /api/github/repositories- List user repositoriesGET /api/github/repositories/:owner/:repo/files- List source filesPOST /api/github/repositories/:owner/:repo/files/batch- Get file contentsPOST /api/github/repositories/:owner/:repo/pull-request- Create PR
POST /api/ai/generate-summaries- Generate test summariesPOST /api/ai/generate-code- Generate test codeGET /api/ai/frameworks/:fileExtension- Get supported frameworks
cd backend
npm run dev # Start with nodemon
npm start # Start production servercd frontend
npm run dev # Start Vite dev server
npm run build # Build for production
npm run preview # Preview production build- Copy
env.exampleto.envin both frontend and backend - Configure GitHub OAuth and AI API keys
- Set appropriate CORS origins for your deployment
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push
- Set environment variables
- Deploy using the provided Dockerfile or build scripts
- Update CORS origins for production
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Add tests if applicable
- Commit:
git commit -m 'Add feature' - Push:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- React - Frontend framework
- Express - Backend framework
- TailwindCSS - Styling
- Lucide React - Icons
- React Hot Toast - Notifications
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your environment details and error messages
Happy Testing! 🧪✨