AI-Powered Test Case Generator and Selenium Automation Code Generator
Streamline your QA workflow with intelligent test case generation and automated code creation for Selenium WebDriver using Java and TestNG.
Generate comprehensive test cases from user stories and requirements using AI
Automatically generate production-ready Selenium automation code in Java
- Manual Test Case Creation - Create detailed test cases with all necessary fields
- AI-Powered Generation - Generate test cases from requirements using Gemini 2.0 Flash
- Context-Aware Generation - Generate additional test cases based on existing context
- Bulk Operations - Select, edit, and delete multiple test cases at once
- Excel Export - Export all test cases to Excel format for documentation
- Java Selenium Code - Generate TestNG-based automation code
- Page Object Model - Uses industry-standard POM design pattern
- Combined Test Suites - Generate single test class with multiple test methods
- Separate Test Classes - Generate individual test files for each test case
- Download as ZIP - Package all generated files for easy integration
- Priority Management - Categorize test cases by High, Medium, Low priority
- File Attachments - Support for screenshots, PDFs, DOCX, and Excel files
- Clean UI - Modern, intuitive interface with smooth navigation
- Statistics Dashboard - Track total and selected test cases
- Toast Notifications - User-friendly feedback for all actions
- Python 3.8 or higher
- Google Gemini API Key (Get it here)
- Git (optional, for version control)
-
Download/Clone the repository
git clone https://github.com/YOUR_USERNAME/qa-test-automation-suite.git cd qa-test-automation-suite -
Run setup script
setup.bat
-
Configure API Key
- Edit
.envfile - Replace
your_api_key_herewith your actual Gemini API key
- Edit
-
Launch the application
streamlit run app.py
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/qa-test-automation-suite.git cd qa-test-automation-suite -
Create virtual environment
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Create
.envfile# Create .env file in root directory with: GEMINI_API_KEY=your_actual_api_key_here APP_ENV=development -
Run the application
streamlit run app.py
-
Open your browser
- Navigate to
http://localhost:8501
- Navigate to
qa-test-automation-suite/
β
βββ app.py # Main application entry point
βββ requirements.txt # Python dependencies
βββ .env # Environment variables (create this)
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ setup.bat # Windows setup script
βββ setup.sh # Linux/Mac setup script
β
βββ assets/
β βββ style.css # Custom CSS styles
β
βββ pages/
β βββ __init__.py
β βββ test_case_gen.py # Test case generator page
β βββ test_automation.py # Automation code generator page
β
βββ utils/
β βββ __init__.py
β βββ ai_utils.py # Gemini AI integration
β βββ code_utils.py # Code parsing utilities
β βββ file_utils.py # File handling (PDF, DOCX, Excel)
β βββ ui_utils.py # UI helper functions
β
βββ screenshots/ # UI screenshots for documentation
βββ test-case-generator.png
βββ test-automation.png
- Navigate to Test Case Generator
- Select Manual Creation tab
- Fill in the form:
- Area: Category (e.g., UI/UX, API, Database)
- Module: Main module name (e.g., Authentication)
- Sub-Module: Specific feature (e.g., Login)
- Test Scenario: Brief description (required)
- Priority: High, Medium, or Low
- Preconditions: Setup requirements
- Test Data: Input data needed
- Test Steps: Detailed steps (required)
- Expected Results: What should happen (required)
- Click Save Test Case
- Navigate to Test Case Generator
- Select AI Generation tab
- Enter your requirements or user story in the text area:
Example: As a user, I want to login so that I can access my account. Acceptance Criteria: β’ Valid credentials allow login β’ Invalid credentials show error message β’ Forgot password link is available - Set number of test cases to generate (1-50)
- Select default priority
- Click Generate Test Cases
- AI will create comprehensive test cases automatically
- In Test Case Library, select test cases using checkboxes
- Click Automate (N) button where N is the number selected
- Choose generation mode:
- Combined Test Suite: Single test class with all tests
- Separate Test Classes: Individual files for each test case
- Click Generate Automation Code
- Review generated Java code with TestNG annotations
- Click Download to get ZIP file with all code files
- In Test Case Library, click Export Excel
- Excel file will download with all test case details:
- ID, Area, Module, Sub-Module
- Title, Priority
- Preconditions, Test Data
- Test Steps, Expected Results
- Attachments list
| Technology | Purpose |
|---|---|
| Python 3.8+ | Core programming language |
| Streamlit | Web application framework |
| Google Gemini 2.0 Flash | AI model for test case and code generation |
| Pandas | Data manipulation and Excel export |
| PyPDF2 | PDF file processing |
| python-docx | Microsoft Word file processing |
| OpenPyXL | Excel file handling |
| python-dotenv | Environment variable management |
Create a .env file in the root directory:
# Google Gemini API Configuration
GEMINI_API_KEY=your_actual_api_key_here
# Application Configuration
APP_ENV=developmentFor Attachments:
- Images: PNG, JPG, JPEG
- Documents: PDF, DOCX, TXT
- Spreadsheets: XLSX, XLS, CSV
- Modern Design: Clean, professional interface with gradient headers
- Responsive Layout: Adapts to different screen sizes
- Priority Indicators: Color-coded icons (π΄ High, π‘ Medium, π’ Low)
- Toast Notifications: Real-time feedback for user actions
- Smooth Animations: Enhanced user experience with transitions
- Sidebar Navigation: Easy switching between pages
- Statistics Dashboard: Quick overview of test case metrics
Issue: ModuleNotFoundError: No module named 'docx'
# Solution
pip install python-docxIssue: GEMINI_API_KEY not configured
# Solution
# 1. Check if .env file exists in root directory
# 2. Verify GEMINI_API_KEY is set correctly
# 3. Restart the applicationIssue: Port 8501 already in use
# Solution
streamlit run app.py --server.port 8502Issue: Changes not reflecting
# Solution
# Hard refresh browser: Ctrl + Shift + R (Windows/Linux) or Cmd + Shift + R (Mac)Issue: Git push rejected
# Solution
git pull origin main --rebase
git push origin main- Support for additional programming languages (Python, JavaScript)
- Integration with test management tools (Jira, TestRail)
- Import test cases from Excel
- Test case templates library
- Test execution reports
- API testing code generation
- Database validation code generation
- Mobile automation support (Appium)
- CI/CD integration examples
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m "Add amazing feature" - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow PEP 8 style guide for Python code
- Add comments for complex logic
- Update documentation for new features
- Test thoroughly before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Amol Magar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Amol Magar
- GitHub: @https://github.com/AmolMagar2000
- LinkedIn: https://linkedin.com/in/amol-magar-06997121a
- Email: amolm986@gmail.com
- Streamlit - Amazing framework for building data apps
- Google Gemini - Powerful AI model
- TestNG - Testing framework inspiration
- Selenium WebDriver - Browser automation standard
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing Issues
- Create a new issue with detailed description
- Contact the author
If you find this project helpful, please give it a β on GitHub!
Built with β€οΈ by Amol Magar
Empowering QA engineers with AI-powered automation