A React application that integrates with GitHub to automatically generate test cases for your code files. This tool helps developers create comprehensive test suites by analyzing code files from GitHub repositories and generating framework-specific test cases.
✅ GitHub Integration: Connect to GitHub using personal access tokens
✅ Repository Browser: Browse and select from your GitHub repositories
✅ Smart File Selection: Automatically detect and filter code files by language
✅ Multi-Framework Support: Generate tests for various frameworks:
- JavaScript/React: Jest + React Testing Library, Cypress E2E
- Python: pytest, Selenium WebDriver
- Java: JUnit 5, Mockito
- C#: NUnit
- Generic: Template-based tests for other languages
✅ Test Summary Generation: Get AI-powered summaries of potential test cases ✅ Code Generation: Generate complete, ready-to-use test files ✅ Pull Request Creation: Automatically create PRs with generated tests (optional)
- Node.js (v20.19.0 or higher)
- GitHub Personal Access Token with
reposcope- Go to GitHub Settings > Developer settings > Personal access tokens
- Generate a new token with
repopermissions
- Clone the repository:
git clone <repository-url>
cd github_testgen- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:5173
- Enter your GitHub Personal Access Token
- Click "Connect to GitHub"
- Browse your repositories
- Use the search function to find specific repos
- Click on a repository to select it
- Review detected code files
- Filter by programming language if needed
- Select files you want to generate tests for
- Click "Generate Tests"
- Review the suggested test case summaries
- Each summary shows:
- Test framework
- Test types (unit, integration, E2E)
- Estimated number of tests
- Click "Generate Test Code" for any summary
- Review the generated test code
- Copy the code or create a Pull Request directly
- After generating test code, click "Create PR"
- The app will:
- Create a new branch
- Add the test file
- Create a pull request with detailed description
- Jest + React Testing Library: Component testing, props validation, event handling
- Jest + MSW: API integration testing with mocked services
- Cypress: End-to-end testing for user workflows
- pytest: Unit testing with fixtures and parameterized tests
- Selenium + pytest: Web automation testing
- JUnit 5: Modern unit testing with annotations and assertions
- JUnit 5 + Mockito: Integration testing with dependency mocking
- NUnit: Unit testing framework with test cases and attributes
- Template-based test structure for other programming languages
Required scopes for your GitHub token:
repo: Full control of private repositoriespublic_repo: Access to public repositories (if you only work with public repos)
The application automatically detects these file types:
- JavaScript:
.js,.jsx - TypeScript:
.ts,.tsx - Python:
.py - Java:
.java - C++/C:
.cpp,.c - C#:
.cs - Go:
.go - PHP:
.php - Ruby:
.rb - Swift:
.swift - Kotlin:
.kt
src/
├── components/ # React components
│ ├── GitHubAuth.jsx # Authentication component
│ ├── RepositorySelector.jsx
│ ├── FileSelector.jsx
│ └── TestGenerator.jsx
├── services/ # Business logic
│ ├── githubService.js # GitHub API integration
│ └── testCaseGenerator.js # Test generation logic
├── App.jsx # Main application component
├── main.jsx # Application entry point
└── index.css # Global styles with Tailwind
- Add framework detection in
testCaseGenerator.js - Implement the code generation method
- Add framework-specific templates
- Update the UI to display the new framework
The app uses GitHub's REST API v3:
- Repository listing
- File content retrieval
- Branch creation
- File creation/updates
- Pull request creation
"Invalid GitHub token"
- Verify your token has the correct permissions
- Check that the token hasn't expired
- Ensure you're using a personal access token, not an OAuth token
"Failed to fetch repositories"
- Check your internet connection
- Verify the GitHub API is accessible
- Try refreshing the token
"Error creating pull request"
- Ensure you have write permissions to the repository
- Check that the repository allows pull requests
- Verify the base branch exists
GitHub API has rate limits:
- Authenticated requests: 5,000 per hour
- Unauthenticated requests: 60 per hour
The app automatically handles rate limiting with proper error messages.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with React and Vite
- Styled with Tailwind CSS
- Icons by Lucide React
- GitHub API integration via Octokit+ Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the TS template for information on how to integrate TypeScript and typescript-eslint in your project.